@kl-c/matrixos 0.1.49 → 0.2.1
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/dist/cli/adopt.d.ts +32 -0
- package/dist/cli/gateway-start.d.ts +39 -0
- package/dist/cli/index.js +56351 -12065
- package/dist/cli-node/index.js +56351 -12065
- package/dist/gateway/gateway-handler.d.ts +44 -0
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gateway message handler.
|
|
3
|
+
*
|
|
4
|
+
* Receives a normalized envelope from the MatrixGateway, dispatches to a
|
|
5
|
+
* MaTrixOS CLI subprocess (default: `matrixos run <text>`), and returns
|
|
6
|
+
* the agent reply to be sent back through the adapter.
|
|
7
|
+
*
|
|
8
|
+
* Why subprocess and not in-process: the agent runtime is OpenCode-driven
|
|
9
|
+
* and uses its own conversation loop. Forcing it into the gateway's event
|
|
10
|
+
* loop is an L-scale refactor; subprocess keeps the gateway stateless and
|
|
11
|
+
* the agent isolated. Each message = fresh agent process, no session
|
|
12
|
+
* reuse for v0 (Phase 1 limitation, documented in TRACABILITE).
|
|
13
|
+
*/
|
|
14
|
+
import type { UnifiedEnvelope } from "@matrixos/matrix-gateway-core";
|
|
15
|
+
export interface GatewayHandlerOptions {
|
|
16
|
+
/** Command to invoke. Default: matrixos (resolved via PATH). */
|
|
17
|
+
readonly command?: string;
|
|
18
|
+
/** Args to pass (default: ["run", text]). Use {text} as placeholder. */
|
|
19
|
+
readonly args?: string[];
|
|
20
|
+
/** Working dir for the subprocess. */
|
|
21
|
+
readonly cwd?: string;
|
|
22
|
+
/** Timeout in ms (default 30s). */
|
|
23
|
+
readonly timeoutMs?: number;
|
|
24
|
+
/** Env overrides (merged on top of process.env, secrets redacted). */
|
|
25
|
+
readonly env?: Record<string, string>;
|
|
26
|
+
/** Optional callback for partial output (Phase 2: streaming). */
|
|
27
|
+
readonly onPartial?: (chunk: string) => void;
|
|
28
|
+
}
|
|
29
|
+
export interface GatewayHandlerResult {
|
|
30
|
+
readonly ok: boolean;
|
|
31
|
+
readonly reply: string;
|
|
32
|
+
readonly durationMs: number;
|
|
33
|
+
readonly exitCode: number | null;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Slash command detection. If the inbound text starts with /adopt, the
|
|
37
|
+
* handler dispatches to the adoption flow instead of the agent subprocess.
|
|
38
|
+
* Returns true if the command was handled inline (caller should not run
|
|
39
|
+
* the subprocess).
|
|
40
|
+
*/
|
|
41
|
+
export declare const ADOPT_COMMAND = "/adopt";
|
|
42
|
+
export declare function isAdoptCommand(env: UnifiedEnvelope): boolean;
|
|
43
|
+
export declare function handleAdoptCommand(env: UnifiedEnvelope, opts?: GatewayHandlerOptions): Promise<GatewayHandlerResult>;
|
|
44
|
+
export declare function handleGatewayMessage(env: UnifiedEnvelope, opts?: GatewayHandlerOptions): Promise<GatewayHandlerResult>;
|
package/dist/index.js
CHANGED
|
@@ -368023,7 +368023,7 @@ function getCachedVersion(options = {}) {
|
|
|
368023
368023
|
// package.json
|
|
368024
368024
|
var package_default = {
|
|
368025
368025
|
name: "@kl-c/matrixos",
|
|
368026
|
-
version: "0.1
|
|
368026
|
+
version: "0.2.1",
|
|
368027
368027
|
description: "MaTrixOS \u2014 Agentic OS for OpenCode. Personalizable, communicating, self-improving, resilient.",
|
|
368028
368028
|
main: "./dist/index.js",
|
|
368029
368029
|
types: "dist/index.d.ts",
|
package/package.json
CHANGED