Commit Graph
11 Commits
Author SHA1 Message Date
cflmy b37026b79d feat(foreign): verify provider digests and record environment metadata (B-12)
- add environment_id/environment_digest/interpreter_version to KernelDescriptor
- require external CLI descriptors to pin an absolute executable and a full
  provider digest
- verify the digest at registration and immediately before every spawn;
  tampering after registration fails with ForeignError::Integrity before spawn
- validate digest formats and reject relative external entrypoints
- pin the example provider digest and add an integrity test
- document that uv/npm environment materialization and lock integration remain
  open; strict isolation is unchanged and still refused
2026-11-20 13:04:53 +08:00
cflmy 9bceac910b feat(tool): negotiate protocols and verify the whole tool bundle (B-09 B-10)
- replace the hand-rolled version matcher with semver; require valid tool
  versions and marqdo ranges
- declare SupportedProtocols (tool 1, analysis 2, trace 2) and negotiate tool
  Analysis/Trace declarations at install and dispatch; disjoint/empty sets fail
  closed with tool.protocol_incompatible
- record a v2 whole-bundle manifest (path/size/sha256 + deterministic bundle
  digest), copy exactly that bundle into staging, re-verify it, and recompute it
  before every dispatch
- reject auxiliary-file, extra-file, missing-file and entrypoint tampering,
  record/command mismatches, traversal and a source root record.json
- remove tools by detaching with rename before deletion
- expose negotiated protocol environment variables to declared tools
- update tool-v1 and STATUS; add negotiation/bundle tests
2026-11-20 13:02:55 +08:00
cflmy 4ce37afb39 feat(m0.6-r6): release examples, public schemas and cross-platform CI
- add runnable examples for an unknown-name Tool, multi-export plugin,
  external kernel provider and same-name multi-version packages
- add JSON Schemas for Analysis v1, Trace v1 and Tool v1 and validate them in CI
- extend CI with protocol/consumer smoke tests and a Windows/macOS cargo check
- add --kernel provider descriptors and R6 example integration tests
- document the examples and update M0.6 status
2026-11-20 11:50:27 +08:00
cflmy 54c7b43d15 feat(m0.6-r5): pinned Git packages and materialized environments
- add content-addressed Git checkout cache for exact revisions; no hooks,
  submodules or floating branches
- resolve transitive @alias imports from each package's own manifest
- materialize locked path/Git packages into .marqdo/env atomically and prefer
  a matching env copy in the resolver
- make sync a real environment sync while keeping lock immutable
- kill Unix foreign-kernel process groups so grandchildren do not survive
- add Git/env/transitive integration tests and update package/security specs
2026-11-20 11:49:05 +08:00
cflmy 21c1e50617 feat(m0.6-r2): explicit foreign kernel provider registry
- add KernelDescriptor/KernelRegistry with built-in Python/Node providers
- route run/call through the registry; external providers need an explicit
  executable and wire version
- expose provider registration on StdHost and use it in the foreign adapter
- add mocklang registration/call, duplicate-label, wire-version and timeout tests
- update spec/foreign.md and M0.6 progress
2026-11-20 11:39:14 +08:00
cflmy 5877d9aa5e feat(m0.6-r1): package-aware module identity and resolver
- replace path-only ModuleId with {instance, relative_path} and canonical
  <instance>::<path> encoding
- add PackageResolver/ResolvedPackage in marqdo-package for path sources;
  hash package trees deterministically for content-addressed instance ids
- move import resolution out of the CLI loader; reject package escapes
- emit lock_version 2 with instance ids and migrate v1 lockfiles
- update references/package-format specs and the function-ref golden
- add package resolver tests for stable identity across path moves
2026-11-20 11:37:16 +08:00
cflmy 7fbd5e9ec1 feat(host,runtime,cli): explicit plugin invocation from documents
Blueprint section 10 / P6: exports of an explicitly trusted plugin are callable
from a `.mq.md` file through a bound namespace.

- host: StdHost::load_plugin requires an explicit trust decision and a granted
  plugin capability, loads the native artifact through the ABI v1 loader with
  no capability handler (all plugin host-capability requests denied), and
  dispatches HostOp::PluginInvoke through the typed wire request/response.
  In-process native code is documented as sharing the host address space; no
  isolated worker transport exists in this build.
- runtime: a qualified call whose base is not a local value, import alias or
  builtin namespace is routed to the plugin namespace; plugin calls take named
  arguments only and plugin values become Marqdo values (Unit when absent).
- cli: run/call gain `--plugin <path>`, `--trust-native-plugin` and reuse
  `--allow-plugin <package>`; missing trust/grant/loaded namespace surface as
  structured errors.
- frontend: member-call bases are namespaces (builtin/import/plugin), never
  inferred parameters, so `solver.add(...)` does not invent a parameter.
2026-11-20 10:46:23 +08:00
cflmy e1ba630068 feat(cli): marqdo init/run/call/check/inspect/fmt/plugin/lock/sync
Composition root wiring the frontend, runtime, host and package layers:

- Project loader: deterministic project-root discovery, explicit front-matter
  imports only (`@dependency` or relative `.mq.md`), recursive module loading
  with cycle diagnostics, resolved import edges and cross-module call checks.
  Loading never executes anything.
- run/call: sandbox mode enforcement (strict refuses when unavailable),
  explicit capability grants, fuel/stack/output/timeout overrides, typed
  `--arg name=value` constants, program stdout separated from diagnostics, and
  machine-readable JSON output that embeds program output without mixing.
- check: static diagnostics only, human-readable locations with source lines
  and stable machine codes in JSON.
- inspect: canonical AST, heading units, signatures (explicit/inferred),
  executable IR, static reference edges (including cross-file links analysed
  without execution) and platform capability report.
- fmt: conservative, AST-preserving normalisation of line endings and trailing
  newlines; --check mode.
- plugin inspect: manifest/ABI/artifact validation and hash verification,
  never loading plugin code.
- init: minimal project (manifest, entry document, .gitignore).
- lock/sync --locked: deterministic path-dependency lockfile, stale lock or
  changed dependency content is an error (no silent upgrades).
- examples: hello, factorial, math formula, Python foreign call, static
  references and a two-module project with an explicit import.
2026-11-20 10:44:03 +08:00
cflmy 62a9af05fd feat(markdown,value): record code span delimiters, inert-executable code and profile refinements
- md code nodes now carry `ticks` (delimiter length) so executable payload
  offsets inside code spans map back to exact source bytes instead of pointing
  at backticks; this keeps diagnostics precise for mixed text/code payloads.
- value: add the markdown.inert_executable warning code and a small clippy fix,
  without changing the wire format.
- spec: document the code-span tick metadata, declare strikethrough lazy, and
  make the inert-execution warning explicit for nodes outside any function.
- workspace dependencies: add unicode-ident (grammar) and glob (capability
  path patterns) for the frontend/host layers.

Tests: 15 markdown + 10 value + 2 span tests pass; fmt/clippy clean.
2026-11-20 10:36:07 +08:00
cflmy 9897ecc37f feat(expression): strict expression and statement grammar for executable payloads
Implement the independent expression parser frozen in spec/expression.ebnf:

- Unicode XID identifiers (Chinese names supported), reserved keywords
  true/false/None/and/or/not.
- Arbitrary-precision Int literals, binary64 Float literals (digits required on
  both sides, overflow rejected), double-quoted Text with \u{...} escapes.
- List and record literals, calls with positional-then-named arguments and
  trailing commas, member access, indexing, chained postfix operators.
- Precedence exactly as specified: right-associative ** with unary minus
  binding outside, multiplicative/additive, single non-associative comparison,
  short-circuit and/or.
- Assignment only as `identifier = expression` at statement start; no comments,
  no second Markdown parser, max nesting depth 128 with structured errors.
- parse_expression/parse_statement/parse_arguments never panic; ParseError has
  stable code expr.parse, payload-relative byte spans and Display/Error.

50 unit tests + 2 doctests, cargo fmt/clippy clean.
2026-11-20 10:35:49 +08:00
cflmy 1520244923 feat(value): value model, structured diagnostics and wire format
Implements the shared data contract from blueprint sections 3.4, 7.2 and 10.3:

- Value: Unit/None/Bool/Int(BigInt)/Float/Text/List/Map/Table/Formula/Code/
  FunctionRef/PluginHandle; Unit and None stay distinct and there is no
  implicit string/number coercion.
- Diagnostic with stable machine-readable codes (markdown.invalid_construct,
  expr.parse, symbol.unknown, permission.denied, ...) and span/related/hints.
- RuntimeError with category codes and call frames; renders to a Diagnostic.
- Versioned, type-tagged JSON wire format (wire_version = 1) that keeps
  arbitrary-precision integers as decimal strings, tags NaN/Infinity, enforces
  depth/size limits on untrusted input and never trusts JSON numbers for Int.
- Byte spans and line/column mapping live in the new marqdo-span crate.
2026-11-20 10:24:13 +08:00