Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
194 commits
Select commit Hold shift + click to select a range
21a1047
feat(core): canonical "boolean" spelling, ParseValueType enforcement,…
the-mindful-dude Dec 1, 2026
1a72595
feat(sdk): required-by-default schema API, .optional()/.nullable() co…
the-mindful-dude Dec 1, 2026
7329d15
feat(execution): canonical composite ValueRef and store-scoped single…
the-mindful-dude Dec 1, 2026
68b1605
fix(execution): update engine test fakes for TransitionCommitter inte…
the-mindful-dude Dec 1, 2026
c999e00
feat: durable result retrieval protocol, composite ValueRefs, SDK sch…
the-mindful-dude Dec 3, 2026
bc458c4
docs: remove .agents from .gitignore
the-mindful-dude Dec 3, 2026
3749013
fix: repair SDK and durable result CI regressions
the-mindful-dude Dec 3, 2026
0af5c8b
fix: align detach execution and format result handler
the-mindful-dude Dec 3, 2026
b29affc
fix(cli): register result command and normalize handler formatting
the-mindful-dude Dec 3, 2026
8cdf950
fix(api): resolve durable results through the instance manager
the-mindful-dude Dec 3, 2026
c27bcfa
fix(api): correct durable result handler integration
the-mindful-dude Dec 3, 2026
d213ad7
feat(cli): complete positional execution result command
the-mindful-dude Dec 3, 2026
a28a018
test(storage): update non-transactional store for lease contract
the-mindful-dude Dec 3, 2026
555cf65
fix(api): align result handler with top-level route
the-mindful-dude Dec 3, 2026
04ac617
test(sdk): cover recursive expression mappings end to end
the-mindful-dude Dec 3, 2026
49388b8
fix(storage): harden execution owner lease fencing
the-mindful-dude Dec 3, 2026
b577487
test: correct recursive expression fixtures and formatting
the-mindful-dude Dec 3, 2026
58a77e0
fix(instance): renew durable execution owner lease
the-mindful-dude Dec 3, 2026
ec99339
fix: normalize lease regression tests and Go formatting
the-mindful-dude Dec 3, 2026
ff5772c
fix(storage): reject expired owner fencing
the-mindful-dude Dec 3, 2026
ac95eef
fix(instance): enforce durable owner on manager mutations
the-mindful-dude Dec 3, 2026
80a8a6b
fix(instance): verify owner against authoritative store
the-mindful-dude Dec 3, 2026
2026fa0
style: apply Go formatting to lease and manager changes
the-mindful-dude Dec 3, 2026
0ae6fa6
fix(execution): fence durable transitions atomically
the-mindful-dude Dec 3, 2026
776f9d2
fix(execution): fence retry and signal wait commits
the-mindful-dude Dec 3, 2026
04a560d
fix(execution): fence signal resolution commits
the-mindful-dude Dec 3, 2026
a09edc6
style: format scheduler owner fencing fields
the-mindful-dude Dec 3, 2026
15bcd6a
test(execution): verify transactional owner fencing
the-mindful-dude Dec 3, 2026
61ea9f3
style: normalize transactional fencing test spacing
the-mindful-dude Dec 3, 2026
6129e41
fix(engine): fence dispatch claims and completion atomically
the-mindful-dude Dec 3, 2026
6535026
test(engine): cover stale-owner dispatch fencing
the-mindful-dude Dec 3, 2026
55a432b
style: normalize fenced committer interface formatting
the-mindful-dude Dec 3, 2026
3acb041
style: normalize dispatch fencing test spacing
the-mindful-dude Dec 3, 2026
ea2a1a1
fix(execution): fence admission and recovery writes
the-mindful-dude Dec 3, 2026
a043ca3
fix(instance): preserve non-durable admission behavior
the-mindful-dude Dec 3, 2026
7c3ada7
fix(execution): preserve ID type in fenced dispatch reset
the-mindful-dude Dec 3, 2026
f5b3a7f
fix(instance): fence metadata writes in storage transactions
the-mindful-dude Dec 3, 2026
d64246f
test(instance): cover stale-owner metadata fencing
the-mindful-dude Dec 3, 2026
fced904
fix(instance): atomically fence manager metadata mutations
the-mindful-dude Dec 3, 2026
4d72803
fix(instance): delete execution events under owner fence
the-mindful-dude Dec 3, 2026
a734eb9
docs(agents): record manager owner-fencing progress
the-mindful-dude Dec 3, 2026
88adf05
fix(instance): allow non-owner managers to serve read-only
the-mindful-dude Dec 3, 2026
e7be40d
test(instance): cover read-only non-owner manager startup
the-mindful-dude Dec 3, 2026
9d7c5be
docs(agents): record read-only non-owner manager behavior
the-mindful-dude Dec 3, 2026
dda2784
fix(instance): fence durable shutdown and failure sweeps
the-mindful-dude Dec 3, 2026
4c28ac4
fix(instance): retain execution owner fence on instances
the-mindful-dude Dec 3, 2026
86fa8d5
docs(agents): record instance fencing CI correction
the-mindful-dude Dec 3, 2026
e926e63
style: align instance owner fence fields
the-mindful-dude Dec 3, 2026
6920c0c
fix(instance): resolve fenced repository interface errors
the-mindful-dude Dec 3, 2026
084bba1
fix(instance): assert fenced execution admission capability
the-mindful-dude Dec 3, 2026
ad6b796
docs(agents): record fenced repository interface fixes
the-mindful-dude Dec 3, 2026
42d6573
fix(instance): fence history restore and snapshot persistence
the-mindful-dude Dec 3, 2026
f30f73e
fix(instance): avoid fencing process-local none-mode storage
the-mindful-dude Dec 3, 2026
d958036
test(instance): exercise none-mode manager execution
the-mindful-dude Dec 3, 2026
ddddfa7
docs(agents): record history and none-mode fencing progress
the-mindful-dude Dec 3, 2026
50dbb5f
fix(instance): make restored non-owner instances read-only
the-mindful-dude Dec 3, 2026
7f2e62f
docs(agents): record read-only instance boundary hardening
the-mindful-dude Dec 3, 2026
8f8d37e
style(instance): align restored instance fields
the-mindful-dude Dec 3, 2026
898f2ed
docs(agents): record restore formatting correction
the-mindful-dude Dec 3, 2026
69a0cd9
test(instance): pass restore ownership context
the-mindful-dude Dec 3, 2026
a670588
docs(agents): record restore test callsite update
the-mindful-dude Dec 3, 2026
9b9cd55
test(instance): expect nil lease on read-only frontend
the-mindful-dude Dec 3, 2026
f80a46d
style(instance): apply gofmt to restored instance literal
the-mindful-dude Dec 3, 2026
160a0d4
fix(runtime): separate daemon and project execution owners
the-mindful-dude Dec 3, 2026
b982870
test(instance): import owner restart fixture helpers
the-mindful-dude Dec 3, 2026
b70a3c3
test(instance): share owner lease across reconciler instances
the-mindful-dude Dec 3, 2026
e5ea40e
docs(agents): record owner role and lease test corrections
the-mindful-dude Dec 3, 2026
3ab3efb
fix(runtime): release execution owner lease on shutdown
the-mindful-dude Dec 3, 2026
b582b87
fix(runtime): preserve lease ownership changes with shutdown release
the-mindful-dude Dec 3, 2026
48a2368
style(instance): format owner lease shutdown test
the-mindful-dude Dec 3, 2026
a431555
style(instance): remove trailing blank line from test
the-mindful-dude Dec 3, 2026
c59827d
fix(runtime): recover crashed execution owners and route to lease holder
the-mindful-dude Dec 3, 2026
296c801
fix(runtime): publish ownership state and harden crash recovery
the-mindful-dude Dec 3, 2026
95bfeac
style(instance): isolate owner callback assignment
the-mindful-dude Dec 3, 2026
ceb9c6c
style(projectruntime): align discovery metadata fields
the-mindful-dude Dec 3, 2026
74a0d8c
style(projectruntime): use gofmt field spacing
the-mindful-dude Dec 3, 2026
8b866a0
test(cli): drain child output during graceful shutdown
the-mindful-dude Dec 3, 2026
d371732
fix(runtime): bound composite reference validation and resolution
the-mindful-dude Dec 3, 2026
3be2d20
test(runtime): exercise actual composite reference cycles
the-mindful-dude Dec 3, 2026
7228eae
style(runtime): apply gofmt to ValueRef changes
the-mindful-dude Dec 3, 2026
f9fe081
style(manifest): format composite ValueRef tests
the-mindful-dude Dec 3, 2026
eaabd68
fix(sdk): validate recursive ValueRefs at manifest boundary
the-mindful-dude Dec 3, 2026
9575a89
fix(sdk): preflight recursive refs and bound object traversal
the-mindful-dude Dec 3, 2026
05f438a
fix(sdk): narrow recursive reference fields for declarations
the-mindful-dude Dec 3, 2026
e63db21
test(sdk): align expect-error with recursive type diagnostic
the-mindful-dude Dec 3, 2026
79319ec
test(runtime): verify manager heartbeat fencing behavior
the-mindful-dude Dec 3, 2026
ddccda1
test(instance): tolerate concurrent timer event delivery
the-mindful-dude Dec 3, 2026
7191d9b
test(runtime): verify single-owner multi-process recovery
the-mindful-dude Dec 4, 2026
dfc6054
test(runtime): harden concurrent recovery acceptance assertions
the-mindful-dude Dec 4, 2026
cb08284
test(runtime): make process recovery replay deterministic
the-mindful-dude Dec 4, 2026
43b4aef
test(runtime): convert execution ID for result polling
the-mindful-dude Dec 4, 2026
afc2519
test(acceptance): provide required blocking stage inputs
the-mindful-dude Dec 4, 2026
971d20d
test(acceptance): provide required recovery stage input
the-mindful-dude Dec 4, 2026
d0612b7
test(acceptance): satisfy blocking capability input contract
the-mindful-dude Dec 4, 2026
eb3e737
test: supply required blocking wait_for input in cancellation fixture
the-mindful-dude Dec 4, 2026
dcac033
test: supply required blocking wait_for input in recovery fixture
the-mindful-dude Dec 4, 2026
0c84758
cli: render execution result fields deterministically
the-mindful-dude Dec 4, 2026
5ba5d35
cli: extract deterministic execution result text rendering
the-mindful-dude Dec 4, 2026
a99ff3a
test: assert stable ordering for execution result text
the-mindful-dude Dec 4, 2026
292063a
cli: import result protocol DTO for text renderer
the-mindful-dude Dec 4, 2026
f63148d
style: normalize result CLI test spacing
the-mindful-dude Dec 4, 2026
91d9a3d
docs: document detached execution and result retrieval CLI
the-mindful-dude Dec 4, 2026
3626396
test: cover execution result retrieval success and not found
the-mindful-dude Dec 4, 2026
f2f3465
example: add TypeScript durable execution assembly
the-mindful-dude Dec 4, 2026
34ce25d
example: add durable execution example package
the-mindful-dude Dec 4, 2026
61e4e36
example: add durable execution example typecheck config
the-mindful-dude Dec 4, 2026
8399201
docs: explain durable execution and result retrieval example
the-mindful-dude Dec 4, 2026
9696fc3
docs: index durable execution example
the-mindful-dude Dec 4, 2026
beadb41
build: keep example package scripts hermetic for workspace validation
the-mindful-dude Dec 4, 2026
9921804
build: add durable execution example to pnpm lockfile
the-mindful-dude Dec 4, 2026
9dd356a
docs: describe execution ownership fencing and result retrieval
the-mindful-dude Dec 4, 2026
547ef3e
example: demonstrate required optional and nullable durable inputs
the-mindful-dude Dec 4, 2026
d084915
docs: show optional and nullable durable example inputs
the-mindful-dude Dec 4, 2026
22cef39
test: cover non-terminal execution result conflict
the-mindful-dude Dec 4, 2026
1f71ab6
example: exercise restart recovery with a long-running built-in command
the-mindful-dude Dec 4, 2026
e53c53d
docs: add durable crash and restart verification steps
the-mindful-dude Dec 4, 2026
608729e
docs: correct durable example build and crash recovery walkthrough
the-mindful-dude Dec 4, 2026
70b5fd2
docs: document canonical type nullability and composite reference con…
the-mindful-dude Dec 4, 2026
ce9d9bf
test: assert execution result route is protected by API token
the-mindful-dude Dec 4, 2026
5f4290a
fix(api): format execution result handler tests
the-mindful-dude Dec 4, 2026
6774330
fix(api): format execution result route tests
the-mindful-dude Dec 4, 2026
50023a8
test(api): declare result contract in result lookup fixture
the-mindful-dude Dec 4, 2026
fbe51aa
style(test): format result contract fixture
the-mindful-dude Dec 4, 2026
c7f3bf2
security(protocol): scope result route to instance
the-mindful-dude Dec 4, 2026
4144ebb
test(protocol): assert instance-scoped result URL
the-mindful-dude Dec 4, 2026
aaa8b02
security(api): enforce instance scope on result reads
the-mindful-dude Dec 4, 2026
08980c2
test(api): use instance-scoped result lookups
the-mindful-dude Dec 4, 2026
836a6a3
test(security): reject cross-instance result access
the-mindful-dude Dec 4, 2026
93d702c
test(api): authenticate scoped result route
the-mindful-dude Dec 4, 2026
0c186d4
security(client): require instance for result lookup
the-mindful-dude Dec 4, 2026
9122974
security(cli): scope result command to instance
the-mindful-dude Dec 4, 2026
9e5ad28
test(cli): require instance and execution IDs for result
the-mindful-dude Dec 4, 2026
241455b
test(client): cover instance-scoped result lookup
the-mindful-dude Dec 4, 2026
ba9f39e
docs(security): scope result retrieval to owning instance
the-mindful-dude Dec 4, 2026
6640e0e
docs(architecture): document instance-scoped result lookup
the-mindful-dude Dec 4, 2026
8428f7f
docs(architecture): clarify scoped result CLI usage
the-mindful-dude Dec 4, 2026
9da0c18
style(test): format result client tests
the-mindful-dude Dec 4, 2026
757327f
test(durability): resolve completed results after store restart
the-mindful-dude Dec 4, 2026
118e281
test(acceptance): use instance-scoped result retrieval
the-mindful-dude Dec 4, 2026
803b39f
test(security): reject unscoped result endpoint
the-mindful-dude Dec 4, 2026
7f260c2
docs(example): use scoped result lookup identifiers
the-mindful-dude Dec 4, 2026
3e7d1b3
ci(example): typecheck durable execution example
the-mindful-dude Dec 4, 2026
288aef1
docs(examples): clarify instance-scoped result lookup
the-mindful-dude Dec 4, 2026
6c78802
docs(protocol): clarify scoped result response semantics
the-mindful-dude Dec 4, 2026
0163ad3
fix(test): assert result DTO object type before indexing
the-mindful-dude Dec 4, 2026
5a17114
test(api): close nonterminal result manager
the-mindful-dude Dec 4, 2026
0c77d09
test(durability): close result test managers
the-mindful-dude Dec 4, 2026
a7c12ac
test(api): set scoped result route path values
the-mindful-dude Dec 4, 2026
0305f0e
feat(api): bound execution result response size
the-mindful-dude Dec 4, 2026
9e656c8
refactor(api): isolate bounded result response writer
the-mindful-dude Dec 4, 2026
2b40f45
test(api): cover execution result response size limit
the-mindful-dude Dec 4, 2026
c3fb9bb
docs: document bounded instance-scoped result retrieval
the-mindful-dude Dec 4, 2026
f992aa9
docs(adr): record scoped result authorization and response budget
the-mindful-dude Dec 4, 2026
8c2ed8f
fix(event): fence durable event persistence by owner lease
the-mindful-dude Dec 4, 2026
6e9f1b4
fix(instance): fence durable event writes
the-mindful-dude Dec 4, 2026
d34583a
test(event): reject stale owner event writes
the-mindful-dude Dec 4, 2026
e8fa0a5
style: normalize Go declaration spacing
the-mindful-dude Dec 4, 2026
18633ce
style: normalize Go declaration spacing
the-mindful-dude Dec 4, 2026
a0aed20
style: normalize Go declaration spacing
the-mindful-dude Dec 4, 2026
f0e3824
docs: clarify atomic fencing of durable event history
the-mindful-dude Dec 4, 2026
fbbf6aa
docs(adr): record durable event append fencing audit
the-mindful-dude Dec 4, 2026
5b13def
fix(execution): fence reconciler claims and releases atomically
the-mindful-dude Dec 4, 2026
64f58f4
fix(execution): apply owner fence to intent release transaction
the-mindful-dude Dec 4, 2026
c98cf69
fix(reconciler): require atomic runtime owner fencing
the-mindful-dude Dec 4, 2026
239235f
fix(instance): pass owner fence to durable reconciler
the-mindful-dude Dec 4, 2026
c67600e
test(reconciler): require runtime owner fence in fixtures
the-mindful-dude Dec 4, 2026
32425cc
test(reconciler): require runtime owner fence in fixtures
the-mindful-dude Dec 4, 2026
25e61ed
test(execution): fence dispatch reconciler batch claims and releases
the-mindful-dude Dec 4, 2026
c03e36f
fix(reconciler): fence normal dispatch claim release
the-mindful-dude Dec 4, 2026
8ebc4b2
docs(adr): record reconciler lease-fencing audit
the-mindful-dude Dec 4, 2026
4b28a58
docs: clarify fenced event and dispatch writes
the-mindful-dude Dec 4, 2026
ef1d8af
fix(contracts): require fenced wait timer operations
the-mindful-dude Dec 4, 2026
875e32d
fix(execution): fence timer claims renewals and cleanup
the-mindful-dude Dec 4, 2026
7c99eea
fix(scheduler): fence due timer claims and cleanup
the-mindful-dude Dec 4, 2026
0495111
refactor(scheduler): simplify fenced timer cleanup
the-mindful-dude Dec 4, 2026
146d286
test(scheduler): adapt timer fakes to fenced wait store
the-mindful-dude Dec 4, 2026
5148bb9
test(scheduler): fence timer takeover fixture
the-mindful-dude Dec 4, 2026
3c7900e
test(execution): reject stale owner timer mutations
the-mindful-dude Dec 4, 2026
b5285b0
docs(adr): record fenced due-timer mutation audit
the-mindful-dude Dec 4, 2026
ae9cbe9
docs: include due timer fencing in ownership guarantees
the-mindful-dude Dec 4, 2026
eedae6c
style: normalize Go formatting
the-mindful-dude Dec 4, 2026
3952823
style: normalize Go formatting
the-mindful-dude Dec 4, 2026
f65b2ad
style: normalize Go formatting
the-mindful-dude Dec 4, 2026
ba90907
style: normalize Go formatting
the-mindful-dude Dec 4, 2026
bb8dcb1
fix(instance): pass resolved owner lease to reconciler
the-mindful-dude Dec 4, 2026
3716263
revert: keep local-only ADR out of branch changes
the-mindful-dude Dec 4, 2026
5fff7d4
fix(instance): scope result resolution before contract work
the-mindful-dude Dec 4, 2026
8558899
fix(api): reject cross-instance results before resolution
the-mindful-dude Dec 4, 2026
70281a9
test(instance): reject cross-instance result before resolution
the-mindful-dude Dec 4, 2026
cd6aef3
style: normalize result manager test spacing
the-mindful-dude Dec 4, 2026
726267d
docs: clarify early instance ownership check for result reads
the-mindful-dude Dec 4, 2026
ecc3f21
chore: keep local agent coordination files out of pull request
the-mindful-dude Dec 4, 2026
3a1b744
test(api): create visible instance for nonterminal result lookup
the-mindful-dude Dec 4, 2026
4d7241e
feat(sdk): add sibling array bindings and editor docs
the-mindful-dude Dec 5, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,12 @@ jobs:
- name: Typecheck SDK
run: pnpm --filter @neuronruntime/sdk typecheck

- name: Typecheck durable execution example
run: pnpm --filter durable_execution_ts typecheck

- name: Typecheck ecommerce order TypeScript example
run: pnpm --filter ecommerce-order-ts typecheck

release-validation:
name: Release build matrix
runs-on: ubuntu-latest
Expand Down
10 changes: 8 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ dist/
.neuron/
**/.neuron/

# ------------------------------------------------------------------------------
# Example capability runtime generated artifacts
# ------------------------------------------------------------------------------
# build.sh writes the capability catalog here; not source.
examples/capability-runtimes/catalog/
# Stray built ELF binary removed by T-119; source (go.mod, main.go) stays tracked.
examples/capability-runtimes/echo/echo

# Node.js
node_modules/
*.tsbuildinfo
Expand Down Expand Up @@ -82,5 +90,3 @@ CURRENT.md
# Coordination & Agent Contracts (local only)
# ------------------------------------------------------------------------------
# Multi-agent coordination surface and the project contract are local-only.
.agents/
AGENTS.md
35 changes: 33 additions & 2 deletions application/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,14 +188,16 @@ Usage:

Flags:
-c, --capability-runtime string run a Capability Runtime directly: a built-in core runtime (neuron:core:set) or an installed one (name[@version])
--detach Return immediately with execution and instance IDs
--format string Output format for the result (json, text) (default "json")
--json Render output as JSON (cannot be combined with --format)
--params string JSON params payload for execution (e.g., '{"key":"value"}')
--params-file string Path to JSON file with params payload
--port string Override local runtime port (default: auto-discover from project)
--remote string Remote Neuron runtime endpoint (e.g., http://host:port)
```

`neuron run` is a client of the project runtime. It discovers the project's runtime endpoint (from `.neuron/` state or the project config), sends one synchronous execution request, and prints the Assembly result to stdout. It does not stream events or return execution handles; to inspect, signal, or cancel an execution, use the [`neuron instance`](#neuron-instance) commands.
`neuron run` is a client of the project runtime. It discovers the project's runtime endpoint (from `.neuron/` state or the project config), sends one execution request, and prints the Assembly result to stdout. By default it waits for a terminal result. With `--detach`, it returns immediately with stable execution and instance IDs; retrieve the terminal result later with `neuron result <execution-id>`. The detached mode does not poll events or wait for completion.

The Assembly is addressed by the `assembly` selector on the request URL, never inside the params payload, so the same command works whether the runtime hosts one Assembly or many. Without an argument, `neuron run` uses the key of the current project build — the one `neuron build` recorded in `.neuron/current.json`. With a target argument it addresses that Assembly instead:

Expand Down Expand Up @@ -223,9 +225,15 @@ neuron run order-processing

# Emit the Assembly result as text instead of JSON
neuron run --format text

# Start an execution and return its IDs without waiting for completion
neuron run --detach

# Return the detached execution handle as JSON
neuron run --detach --json
```

stdout contains only the Assembly result in the selected `--format`; logs, diagnostics, and execution errors go to stderr, and a failed or cancelled execution exits non-zero. The result comes from one synchronous request — the command does not stream events, expose execution handles, or list execution history.
In synchronous mode, stdout contains only the Assembly result in the selected `--format`; logs, diagnostics, and execution errors go to stderr, and a failed or cancelled execution exits non-zero. `--json` selects JSON output and cannot be combined with an explicitly supplied `--format`. In detached mode, stdout contains the execution ID, instance ID, and current status (or their JSON representation with `--json`); it does not contain the Assembly result.

#### Direct Capability Runtime invocation

Expand All @@ -247,6 +255,29 @@ Core runtimes (`set`, `ai`, `command`, `delay`, `http`, `log` under `neuron:core

Starting an execution (optionally detached) and streaming its events remain advanced API operations. Cancelling a specific execution is also available from the CLI with `neuron instance cancel`, and waiting executions can be inspected with `neuron instance list --status waiting`; see [`neuron instance`](#neuron-instance).

### `neuron result`

Retrieve the resolved Assembly result for a terminal execution by its execution ID. The command makes one result request; it does not poll or subscribe to execution events. If the execution is still running or waiting, the runtime returns HTTP 409 and the command exits non-zero. An unknown execution ID returns 404.

```
Usage:
neuron result <execution-id> [flags]

Flags:
--json Render the complete result response as JSON
```

```bash
# Start detached, then retrieve the result when the execution is terminal
neuron run --detach
neuron result exec_123

# Retrieve the complete response as JSON
neuron result exec_123 --json
```

Text output prints the terminal status followed by result fields in deterministic key order. A terminal execution failure is printed to stderr and exits non-zero; JSON output includes the complete result response, including its error when present.

### `neuron add`

Resolve and install an external module (capability runtime) into the local store.
Expand Down
25 changes: 25 additions & 0 deletions application/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,31 @@ func (c *Client) StreamExecutionEvents(ctx context.Context, instanceID string, e
})
}

// Result retrieves the resolved Assembly result for an execution within the
// specified instance. Both IDs are required: execution IDs are identifiers,
// not authorization capabilities. It calls the endpoint once and does not poll
// events or depend on a live execution stream.
//
// A non-terminal execution returns HTTP 409. Unknown executions and
// cross-instance mismatches both return HTTP 404.
func (c *Client) Result(ctx context.Context, instanceID, executionID string) (protocol.ExecutionResultResponse, error) {
if instanceID == "" {
return protocol.ExecutionResultResponse{}, fmt.Errorf("instance ID is required")
}
if executionID == "" {
return protocol.ExecutionResultResponse{}, fmt.Errorf("execution ID is required")
}

var response struct {
Data protocol.ExecutionResultResponse `json:"data"`
}
endPoint := protocol.ExecutionResultURL(instanceID, executionID)
if err := c.conn.Do(ctx, http.MethodGet, endPoint, nil, &response); err != nil {
return protocol.ExecutionResultResponse{}, err
}
return response.Data, nil
}

// StreamExecutionEventsWS connects to the WebSocket stream for an execution and
// calls the emit callback for each StreamEvent received. It subscribes to the
// execution's room and blocks until the stream ends or the context is
Expand Down
40 changes: 40 additions & 0 deletions application/client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,46 @@ func newTestWSServer(t *testing.T, events []shared.Message) *httptest.Server {
return srv
}

func TestResultUsesInstanceScopedRoute(t *testing.T) {
var gotPath string
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
gotPath = r.URL.Path
_ = json.NewEncoder(w).Encode(protocol.Response{
Status: http.StatusOK,
Message: "execution result",
Data: protocol.ExecutionResultResponse{
ExecutionID: "exec_1",
InstanceID: "inst_1",
Status: "completed",
Result: map[string]any{"status": "ok"},
},
})
}))
t.Cleanup(srv.Close)

c := NewEndpoint(srv.URL)
result, err := c.Result(context.Background(), "inst_1", "exec_1")
if err != nil {
t.Fatalf("Result: %v", err)
}
if gotPath != protocol.ExecutionResultURL("inst_1", "exec_1") {
t.Fatalf("path = %q, want %q", gotPath, protocol.ExecutionResultURL("inst_1", "exec_1"))
}
if result.InstanceID != "inst_1" || result.ExecutionID != "exec_1" || result.Status != "completed" {
t.Fatalf("result = %+v", result)
}
}

func TestResultRequiresBothIdentifiers(t *testing.T) {
c := NewEndpoint("http://127.0.0.1")
if _, err := c.Result(context.Background(), "", "exec_1"); err == nil {
t.Fatal("Result accepted an empty instance ID")
}
if _, err := c.Result(context.Background(), "inst_1", ""); err == nil {
t.Fatal("Result accepted an empty execution ID")
}
}

func TestStreamExecutionEventsWS(t *testing.T) {
evtData, _ := json.Marshal(protocol.StreamEvent{
ID: "evt_1",
Expand Down
7 changes: 6 additions & 1 deletion application/cmd/neuron/main.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
package main

import (
"context"
"fmt"
"os"
"os/signal"

"github.com/neuron-runtime/neuron/application/internal/cli"
)

func main() {
ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt)
defer stop()

// The root command never prints errors itself (cobra's SilenceErrors and
// SilenceUsage are set in cli.go); this is the single, uniform error
// surface for every command.
if err := cli.Execute(); err != nil {
if err := cli.ExecuteContext(ctx); err != nil {
fmt.Fprintf(os.Stderr, "\u2717 %s\n", err)
os.Exit(1)
}
Expand Down
31 changes: 27 additions & 4 deletions application/compiler/compiler.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,24 +119,47 @@ func (c *Compiler) InstanceKey(m *manifest.Assembly, env string) (protocol.Insta
// resolution are ever snake_cased, and a declared contract is not one.
//
// Rules are validated before conversion because they do not yet exist on
// core.Port: an unsupported rule would otherwise be dropped silently. The
// validation is source-language independent — it runs on the canonical
// manifest for YAML, TypeScript, or any other authoring surface.
// core.Port: an unsupported rule would otherwise be dropped silently. Port
// types go through core.ParseValueType rather than a cast, so an unknown or
// misspelled type fails the build for every authoring surface. The validation
// is source-language independent — it runs on the canonical manifest for YAML,
// TypeScript, or any other authoring surface.
func convertPorts(ports []manifest.Port) ([]core.Port, error) {
out := make([]core.Port, 0, len(ports))
for _, p := range ports {
if err := manifest.ValidatePortRules(p); err != nil {
return nil, fmt.Errorf("port %q: %w", p.Name, err)
}
valueType, err := core.ParseValueType(p.Type)
if err != nil {
return nil, fmt.Errorf("port %q: %w", p.Name, err)
}
out = append(out, core.Port{
Name: p.Name,
Type: core.ValueType(p.Type),
Type: valueType,
Required: p.Required,
Nullable: p.Nullable,
})
}
return out, nil
}

// canonicalizeValueRef converts a legacy mapping expression string into a
// canonical core.ValueRef, validating depth ≤ 64 and acyclicity. It is
// integrated into the compiler's result-schema and binding-pipeline so that
// every structured reference reaches the runtime in a validated, deterministic
// form regardless of the authoring surface.
func canonicalizeValueRef(expr string, fromCapability string) (core.ValueRef, error) {
ref, err := core.ParseMappingSource(fromCapability, expr)
if err != nil {
return core.ValueRef{}, err
}
if err := core.ValidateValueRef(ref, nil, 0, 0); err != nil {
return core.ValueRef{}, err
}
return ref, nil
}

// compileAssemblyResult validates the Assembly's declared result contract
// against the manifest and carries it into the runtime representation.
//
Expand Down
Loading
Loading