@xenosystem/agent-interface-runtime 0.1.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,67 @@
1
+ XENO Agent — Proprietary Software License
2
+ Copyright © 2026 XENO Corporation. All rights reserved.
3
+
4
+ This software, including its source code, compiled binaries, published packages,
5
+ assets, and accompanying documentation (collectively, the "Software"), is the
6
+ proprietary and confidential property of XENO Corporation ("XENO"). The Software
7
+ is licensed for use, not sold, and no title to or ownership of the Software is
8
+ transferred to any user.
9
+
10
+ 1. GRANT OF USE
11
+ Subject to a separate written agreement and/or the terms of service published
12
+ at https://xenostudio.ai, XENO grants the end user a limited, non-exclusive,
13
+ non-transferable, revocable license to install and use the Software for its
14
+ intended purpose. The standalone desktop application ("the Agent") may be used
15
+ locally at no charge; connected platform features — hosted agent runs, model
16
+ inference, credits, and account services — are governed by the applicable
17
+ subscription and the XENO terms of service.
18
+
19
+ 2. PACKAGE DISTRIBUTION
20
+ The `@xeno-corporation/xeno-agent-interface-*` and
21
+ `@xeno-corporation/xeno-agents-client` packages are published to a PRIVATE
22
+ registry and are licensed for use solely by XENO products and by parties
23
+ holding a separate written agreement with XENO. Access credentials to that
24
+ registry do not grant redistribution rights. Publication of any package in
25
+ this repository to a public registry is prohibited without written
26
+ authorization from XENO.
27
+
28
+ 3. RESTRICTIONS
29
+ Except to the extent expressly permitted by applicable law or by a separate
30
+ written agreement with XENO, you may NOT: (a) copy, redistribute, sell, rent,
31
+ lease, sublicense, or otherwise transfer the Software; (b) modify, adapt,
32
+ translate, or create derivative works of the Software; (c) reverse-engineer,
33
+ decompile, or disassemble the Software, or attempt to derive its source code;
34
+ (d) remove, obscure, or alter any proprietary notices; or (e) use the Software
35
+ to build a competing product.
36
+
37
+ 4. RESERVATION OF RIGHTS
38
+ All rights not expressly granted are reserved by XENO Corporation. The Software
39
+ is protected by copyright and other intellectual-property laws and treaties.
40
+
41
+ 5. DISCLAIMER OF WARRANTY
42
+ THE SOFTWARE IS PROVIDED "AS IS" AND "AS AVAILABLE", WITHOUT WARRANTY OF ANY
43
+ KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
44
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THE
45
+ SOFTWARE EXECUTES AGENT-DIRECTED OPERATIONS AGAINST A USER-SELECTED WORKSPACE,
46
+ INCLUDING FILE AND PROCESS ACTIONS; THE USER IS RESPONSIBLE FOR THE WORKSPACES
47
+ AND PERMISSIONS THEY GRANT IT.
48
+
49
+ 6. LIMITATION OF LIABILITY
50
+ TO THE MAXIMUM EXTENT PERMITTED BY LAW, IN NO EVENT SHALL XENO CORPORATION BE
51
+ LIABLE FOR ANY INDIRECT, INCIDENTAL, SPECIAL, CONSEQUENTIAL, OR PUNITIVE
52
+ DAMAGES, OR ANY LOSS OF PROFITS OR DATA, ARISING FROM OR RELATED TO THE USE OF
53
+ OR INABILITY TO USE THE SOFTWARE.
54
+
55
+ 7. THIRD-PARTY COMPONENTS
56
+ The Software includes third-party open-source components, each licensed under
57
+ its own terms; those terms govern those components and are not superseded by
58
+ this license. It also composes third-party agent providers over the Agent
59
+ Client Protocol and hosted APIs; use of those providers is governed by their
60
+ own terms.
61
+
62
+ For licensing inquiries, contact: legal@xenostudio.ai
63
+
64
+ NOTE TO OPERATOR: confirm the exact legal entity name and notice/contact details
65
+ with counsel before public distribution and code-signing (the code-signing
66
+ publisher name must match the registered entity). No public distribution of this
67
+ product is authorized by this file — see docs/PRODUCT_STATUS.md.
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Where the XENO Cloud client looks for credentials and endpoints.
3
+ *
4
+ * Shared so there is exactly ONE of these. A second copy was written while
5
+ * factoring the shared composition (ADE §9 step 3) and it was **wrong** — it
6
+ * invented `credentialsDirectory` and `platformBaseUrl`, neither of which this
7
+ * client reads, and dropped `directApiBase` and `platformModelsUrl` entirely.
8
+ * The result would have typechecked, started, and quietly resolved credentials
9
+ * from the wrong place.
10
+ *
11
+ * That is the argument for extraction stated as a fact rather than a principle:
12
+ * the duplicate did not drift over months, it was born wrong within minutes,
13
+ * because reproducing a config mapping from memory is exactly the kind of thing
14
+ * nobody reproduces correctly.
15
+ *
16
+ * No Electron import — `homeDirectory` is a parameter, which is the only part a
17
+ * windowed process knows and a headless one does not.
18
+ */
19
+ import type { DiscoverXenoCloudNodeRuntimeOptions } from '@xenosystem/agents-client/node';
20
+ export interface StandaloneCloudOptionsInput {
21
+ /** The user's home directory, from whichever runtime knows it. */
22
+ homeDirectory: string;
23
+ /** This host's own root, used as the credential home under the E2E harness. */
24
+ hostRoot: string;
25
+ env?: NodeJS.ProcessEnv;
26
+ }
27
+ export declare function standaloneCloudOptions(input: StandaloneCloudOptionsInput): DiscoverXenoCloudNodeRuntimeOptions;
28
+ //# sourceMappingURL=cloudOptions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cloudOptions.d.ts","sourceRoot":"","sources":["../src/cloudOptions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,mCAAmC,EAAE,MAAM,gCAAgC,CAAA;AAEzF,MAAM,WAAW,2BAA2B;IAC1C,kEAAkE;IAClE,aAAa,EAAE,MAAM,CAAA;IACrB,+EAA+E;IAC/E,QAAQ,EAAE,MAAM,CAAA;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAA;CACxB;AAED,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,2BAA2B,GACjC,mCAAmC,CAiBrC"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Where the XENO Cloud client looks for credentials and endpoints.
3
+ *
4
+ * Shared so there is exactly ONE of these. A second copy was written while
5
+ * factoring the shared composition (ADE §9 step 3) and it was **wrong** — it
6
+ * invented `credentialsDirectory` and `platformBaseUrl`, neither of which this
7
+ * client reads, and dropped `directApiBase` and `platformModelsUrl` entirely.
8
+ * The result would have typechecked, started, and quietly resolved credentials
9
+ * from the wrong place.
10
+ *
11
+ * That is the argument for extraction stated as a fact rather than a principle:
12
+ * the duplicate did not drift over months, it was born wrong within minutes,
13
+ * because reproducing a config mapping from memory is exactly the kind of thing
14
+ * nobody reproduces correctly.
15
+ *
16
+ * No Electron import — `homeDirectory` is a parameter, which is the only part a
17
+ * windowed process knows and a headless one does not.
18
+ */
19
+ export function standaloneCloudOptions(input) {
20
+ const env = input.env ?? process.env;
21
+ return {
22
+ // The E2E harness must never read the developer's real credentials, so it
23
+ // is pointed at the host root it already owns. An explicit override wins
24
+ // over both, because a test rig that cannot say where to look is a test rig
25
+ // that reads whatever happens to be there.
26
+ homeDirectory: env.XENO_AGENT_CLOUD_CREDENTIAL_ROOT
27
+ || (env.XENO_AGENT_E2E === '1' ? input.hostRoot : input.homeDirectory),
28
+ ...(env.XENO_AGENT_CLOUD_BASE_URL ? { baseUrl: env.XENO_AGENT_CLOUD_BASE_URL } : {}),
29
+ ...(env.XENO_AGENT_CLOUD_DIRECT_API_BASE
30
+ ? { directApiBase: env.XENO_AGENT_CLOUD_DIRECT_API_BASE }
31
+ : {}),
32
+ ...(env.XENO_AGENT_CLOUD_PLATFORM_MODELS_URL
33
+ ? { platformModelsUrl: env.XENO_AGENT_CLOUD_PLATFORM_MODELS_URL }
34
+ : {}),
35
+ };
36
+ }
37
+ //# sourceMappingURL=cloudOptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cloudOptions.js","sourceRoot":"","sources":["../src/cloudOptions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAYH,MAAM,UAAU,sBAAsB,CACpC,KAAkC;IAElC,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,CAAA;IACpC,OAAO;QACL,0EAA0E;QAC1E,yEAAyE;QACzE,4EAA4E;QAC5E,2CAA2C;QAC3C,aAAa,EAAE,GAAG,CAAC,gCAAgC;eAC9C,CAAC,GAAG,CAAC,cAAc,KAAK,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC;QACxE,GAAG,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,GAAG,CAAC,yBAAyB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACpF,GAAG,CAAC,GAAG,CAAC,gCAAgC;YACtC,CAAC,CAAC,EAAE,aAAa,EAAE,GAAG,CAAC,gCAAgC,EAAE;YACzD,CAAC,CAAC,EAAE,CAAC;QACP,GAAG,CAAC,GAAG,CAAC,oCAAoC;YAC1C,CAAC,CAAC,EAAE,iBAAiB,EAAE,GAAG,CAAC,oCAAoC,EAAE;YACjE,CAAC,CAAC,EAAE,CAAC;KACR,CAAA;AACH,CAAC"}
@@ -0,0 +1,171 @@
1
+ /**
2
+ * The Agent host composition — ONE of them, used by every product surface.
3
+ *
4
+ * ADE §9 build-order step 3 needs the host to be able to run in a process with
5
+ * no windows. The obvious way to get there is to write a second, smaller
6
+ * composition for the detached entry. That is a fork, and this repo's own
7
+ * invariant (`AGENTS.md`: no surface-specific fork) says why it is the wrong
8
+ * shape: two compositions drift, and the one that drifts is always the one
9
+ * fewer people run.
10
+ *
11
+ * So there is one builder, and the Electron-only capabilities are INJECTED. A
12
+ * surface that has windows passes them; a headless process passes none.
13
+ *
14
+ * ## 🔴 Absent capabilities are declared, never silently dropped
15
+ *
16
+ * ⚠️ CORRECTED 2026-08-18. This said the SDK-native lane cannot run without
17
+ * `createSdkRuntimeWindow`, "its tools take a live BrowserWindow". Measured, that
18
+ * is false: the loop takes an `SdkAgentSurface` (send + isDestroyed) and loads in
19
+ * plain Node, and the surface tools act through `SdkAgentSurfaceRuntimeAdapter`,
20
+ * whose unregistered default refuses honestly. A window is now one way to run the
21
+ * lane; the headless runner is the other, and it differs only in where events go
22
+ * and who can answer a prompt.
23
+ *
24
+ * The principle the paragraph was written for is untouched, and still applies to
25
+ * every capability that IS genuinely absent here: the tempting response is to
26
+ * leave the provider out of the catalog entirely.
27
+ *
28
+ * That is wrong, and the reason generalises: **a provider that vanishes looks
29
+ * like a configuration error.** An operator sees a shorter list and goes looking
30
+ * for what they broke. A provider that is PRESENT and reports
31
+ * `runnable: false` with a reason has told them the truth — this build cannot
32
+ * run that lane, and here is why. The descriptor already carries
33
+ * `safeUnavailableReason` for exactly this, so honesty costs a string.
34
+ *
35
+ * ## §9 step 3 — ADOPTED
36
+ *
37
+ * Both entries run this. `apps/desktop/src/main/index.ts` calls it with a full
38
+ * `surface`; `detachedHostEntry.ts` calls it with `{}`. The fork it existed to
39
+ * remove is gone, and with it the failure mode that made the case: for weeks
40
+ * each composition was missing services the other had, in both directions —
41
+ * the four §5 services reached the detached host and never the app, while
42
+ * tier-1 observation and the §5.7 landing queue reached the app and never the
43
+ * detached host. Neither gap is visible from inside one composition, and a test
44
+ * that mounts its own fixture cannot see them at all.
45
+ *
46
+ * 🔴 `createCoordinator()` is DEFERRED, and that is the one thing not to
47
+ * "simplify". Composing is safe in any process; the coordinator opens the
48
+ * durable SQLite state, and two of those open at once is the split-brain the
49
+ * host lease exists to prevent. So the composition is eager — a surface still
50
+ * needs its shell service and registry while another process owns the host —
51
+ * and only the coordinator waits for the election.
52
+ */
53
+ import { AcpAgentRegistryService, AgentHostCoordinator, EngineeringWorkbenchService, RunObservationService, RuntimeEventStore, WorkspaceHostService, WorkspaceShellService, XenoUseRunObserver, type LocalAgentHostPaths } from '@xenosystem/agent-interface-host/node';
54
+ import { type DiscoverXenoCloudNodeRuntimeOptions } from '@xenosystem/agents-client/node';
55
+ /**
56
+ * What a windowed surface can lend the host.
57
+ *
58
+ * Every field is optional and every absence has a stated consequence — that is
59
+ * what makes this a capability set rather than a pile of nullable arguments.
60
+ */
61
+ export interface HostSurfaceCapabilities {
62
+ /**
63
+ * Opens paths in the OS. Absent, workspace "reveal in folder" is unavailable
64
+ * rather than silently doing nothing.
65
+ */
66
+ shell?: {
67
+ openPath: (path: string) => Promise<string>;
68
+ showItemInFolder: (path: string) => void;
69
+ };
70
+ /**
71
+ * Creates a runtime window for the SDK-native lane.
72
+ *
73
+ * Absent, that lane still runs — through the headless runner, which routes its two blocking
74
+ * channels to attached clients and refuses them when nobody is there. What is lost is the
75
+ * ability to PRESENT a prompt from this process, not the ability to execute a turn.
76
+ */
77
+ createSdkRuntimeWindow?: () => unknown;
78
+ /**
79
+ * Sends an elicitation to a surface (permission prompts, directory choosers).
80
+ * Absent, the ACP permission bridge has no interactive half and fails closed,
81
+ * which is the correct direction: a prompt nobody can answer is a refusal.
82
+ */
83
+ sendElicitation?: (channel: string, payload: Record<string, unknown>) => void;
84
+ }
85
+ export interface ComposeAgentHostOptions {
86
+ homeDirectory: string;
87
+ hostVersion: string;
88
+ hostInstanceId: string;
89
+ /** Where a fixture agent script lives, when the fixture is enabled. */
90
+ fixtureBaseDirectory: string;
91
+ surface: HostSurfaceCapabilities;
92
+ env?: NodeJS.ProcessEnv;
93
+ }
94
+ export interface AgentHostComposition {
95
+ /**
96
+ * Builds the coordinator — and everything that owns durable state with it.
97
+ *
98
+ * 🔴 Deferred, and called ONLY by the process that won the host lease.
99
+ * The coordinator opens the SQLite state repository, and two processes
100
+ * holding that open is the split-brain the lease exists to prevent. Every
101
+ * other part of this composition is safe to build in any process, which is
102
+ * why they are eager and this one is not: a surface still needs its shell
103
+ * service and its registry while another process owns the host.
104
+ *
105
+ * Idempotent. A second call returns the same coordinator rather than opening
106
+ * the state twice, because the lease is acquired once but shutdown paths can
107
+ * race.
108
+ */
109
+ createCoordinator: () => Promise<AgentHostCoordinator>;
110
+ paths: LocalAgentHostPaths;
111
+ registry: AcpAgentRegistryService;
112
+ runtimeStore: RuntimeEventStore;
113
+ workspaceAuthority: WorkspaceHostService;
114
+ workspaceShellService: WorkspaceShellService | undefined;
115
+ engineeringControlService: EngineeringWorkbenchService;
116
+ /**
117
+ * Tier-1 observation (§2.9), when an operator configured a `xeno-use`
118
+ * sidecar. Absent means NO observation — never an empty one, which would
119
+ * report every run as a clean diff of changes nobody watched.
120
+ */
121
+ runObservationService: RunObservationService | undefined;
122
+ /**
123
+ * The live observer, exposed so a surface can tear its sandboxes down on its
124
+ * own schedule. `dispose()` already stops them; this is for a caller that
125
+ * must stop them EARLIER, before the rest of its shutdown.
126
+ */
127
+ runObserver: XenoUseRunObserver | undefined;
128
+ /** Lanes this composition declared unrunnable, and why. */
129
+ declaredUnavailable: Array<{
130
+ lane: string;
131
+ reason: string;
132
+ }>;
133
+ /**
134
+ * The execution lanes this composition actually REGISTERED.
135
+ *
136
+ * 🔴 Exposed so "the lane is available" can be checked against something that executes, rather
137
+ * than against the declaration alone. The two are independent — a composition can declare a
138
+ * lane available and register no adapter for it, which is the §7.1 failure in its worst form:
139
+ * the catalog offers it, the user selects it, and the turn dies at execution time reading as
140
+ * "the agent is broken" rather than "not here".
141
+ */
142
+ turnExecutionAdapterIds: string[];
143
+ /**
144
+ * Releases what this composition holds open — today, the SQLite state handle.
145
+ *
146
+ * 🔴 A composition that cannot be disposed cannot HAND OVER. The detached
147
+ * host's own rule is that losing the lease stops the process, because two
148
+ * writers on one durable state is the split-brain the lease exists to prevent
149
+ * — and on Windows a held SQLite file blocks the next owner from opening the
150
+ * same directory. Relying on process exit to release it works only for the
151
+ * case where the process exits, which is exactly not the interesting one.
152
+ *
153
+ * Idempotent: a second call is a no-op, because a stop path that runs twice
154
+ * under a race must not turn a clean shutdown into an error.
155
+ */
156
+ dispose: () => Promise<void>;
157
+ }
158
+ export declare function composeAgentHost(options: ComposeAgentHostOptions): Promise<AgentHostComposition>;
159
+ /**
160
+ * The provider catalog.
161
+ *
162
+ * `sdkRunnable` is a parameter rather than being derived here, because whether
163
+ * the lane can run is a fact about the SURFACE, and this function only knows
164
+ * about credentials. Deriving it would make a headless host advertise a lane it
165
+ * cannot execute — the capability-honesty failure (§7.1) in its plainest form.
166
+ */
167
+ export declare function loadAgentHostProviders(registry: AcpAgentRegistryService, cloudOptions: DiscoverXenoCloudNodeRuntimeOptions, options: {
168
+ sdkRunnable: boolean;
169
+ durablePendingInjections?: boolean;
170
+ }): Promise<import("@xenosystem/agent-interface-contract").AgentRuntimeProviderDescriptor[]>;
171
+ //# sourceMappingURL=composeHost.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"composeHost.d.ts","sourceRoot":"","sources":["../src/composeHost.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AASH,OAAO,EACL,uBAAuB,EAIvB,oBAAoB,EAKpB,2BAA2B,EAM3B,qBAAqB,EAErB,iBAAiB,EAQjB,oBAAoB,EACpB,qBAAqB,EAErB,kBAAkB,EAalB,KAAK,mBAAmB,EAEzB,MAAM,uCAAuC,CAAA;AAC9C,OAAO,EAIL,KAAK,mCAAmC,EACzC,MAAM,gCAAgC,CAAA;AAuBvC;;;;;GAKG;AACH,MAAM,WAAW,uBAAuB;IACtC;;;OAGG;IACH,KAAK,CAAC,EAAE;QACN,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAA;QAC3C,gBAAgB,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;KACzC,CAAA;IACD;;;;;;OAMG;IACH,sBAAsB,CAAC,EAAE,MAAM,OAAO,CAAA;IACtC;;;;OAIG;IACH,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAA;CAC9E;AAED,MAAM,WAAW,uBAAuB;IACtC,aAAa,EAAE,MAAM,CAAA;IACrB,WAAW,EAAE,MAAM,CAAA;IACnB,cAAc,EAAE,MAAM,CAAA;IACtB,uEAAuE;IACvE,oBAAoB,EAAE,MAAM,CAAA;IAC5B,OAAO,EAAE,uBAAuB,CAAA;IAChC,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAA;CACxB;AAED,MAAM,WAAW,oBAAoB;IACnC;;;;;;;;;;;;;OAaG;IACH,iBAAiB,EAAE,MAAM,OAAO,CAAC,oBAAoB,CAAC,CAAA;IACtD,KAAK,EAAE,mBAAmB,CAAA;IAC1B,QAAQ,EAAE,uBAAuB,CAAA;IACjC,YAAY,EAAE,iBAAiB,CAAA;IAC/B,kBAAkB,EAAE,oBAAoB,CAAA;IACxC,qBAAqB,EAAE,qBAAqB,GAAG,SAAS,CAAA;IACxD,yBAAyB,EAAE,2BAA2B,CAAA;IACtD;;;;OAIG;IACH,qBAAqB,EAAE,qBAAqB,GAAG,SAAS,CAAA;IACxD;;;;OAIG;IACH,WAAW,EAAE,kBAAkB,GAAG,SAAS,CAAA;IAC3C,2DAA2D;IAC3D,mBAAmB,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IAC5D;;;;;;;;OAQG;IACH,uBAAuB,EAAE,MAAM,EAAE,CAAA;IACjC;;;;;;;;;;;;OAYG;IACH,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CAC7B;AAED,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,uBAAuB,GAC/B,OAAO,CAAC,oBAAoB,CAAC,CAgyB/B;AAED;;;;;;;GAOG;AACH,wBAAsB,sBAAsB,CAC1C,QAAQ,EAAE,uBAAuB,EACjC,YAAY,EAAE,mCAAmC,EACjD,OAAO,EAAE;IAAE,WAAW,EAAE,OAAO,CAAC;IAAC,wBAAwB,CAAC,EAAE,OAAO,CAAA;CAAE,4FA+BtE"}