@cotal-ai/connector-jcode 0.48.2 → 0.49.0
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/extension.d.ts.map +1 -1
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +1059 -309
- package/dist/index.js +45 -23
- package/dist/mcp.js +132 -74
- package/dist/route-identity.d.ts +11 -10
- package/dist/route-identity.d.ts.map +1 -1
- package/dist/startup-diagnostics.d.ts +28 -11
- package/dist/startup-diagnostics.d.ts.map +1 -1
- package/dist/stored-sessions.d.ts +41 -0
- package/dist/stored-sessions.d.ts.map +1 -0
- package/package.json +4 -4
package/dist/route-identity.d.ts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Say which provider is actually carrying a seat's model.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* so establishing it meant reading the seat's private log by hand (#785).
|
|
4
|
+
* A seat can be pinned to the model an operator asked for while its traffic is carried by a component
|
|
5
|
+
* nobody named: one seat was requested as a given model, logged every line under a different
|
|
6
|
+
* provider's name, and died inside a third component's plugin. Nothing in the roster, the spawn
|
|
7
|
+
* confirmation, or the manager's exit line named the route, so establishing it meant reading the
|
|
8
|
+
* seat's private log by hand (#785).
|
|
10
9
|
*
|
|
11
10
|
* `RuntimeInfo` carries `provider` and `routes` in the same response the model check already reads,
|
|
12
11
|
* so this is a reporting gap, not a discovery problem.
|
|
@@ -25,13 +24,15 @@ export interface RuntimeIdentity {
|
|
|
25
24
|
providers?: string[];
|
|
26
25
|
routes?: RouteInfo[];
|
|
27
26
|
}
|
|
27
|
+
/** The route serving `model`. RuntimeInfo's active provider disambiguates duplicate model ids. */
|
|
28
|
+
export declare function activeModelRoute(runtime: RuntimeIdentity | undefined, model: string): RouteInfo | undefined;
|
|
28
29
|
/**
|
|
29
30
|
* One line naming the effective route for `model`.
|
|
30
31
|
*
|
|
31
|
-
* The
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
32
|
+
* The requested pin selects the model whose route is described. RuntimeInfo.model can lag behind a
|
|
33
|
+
* successful setModel, while RuntimeInfo.provider identifies the active route among duplicate model
|
|
34
|
+
* ids. When no matching route is known, the provider remains useful diagnostic context. When neither
|
|
35
|
+
* is known the line says so explicitly rather than guessing or going quiet.
|
|
35
36
|
*/
|
|
36
37
|
export declare function describeRoute(runtime: RuntimeIdentity | undefined, model: string): string;
|
|
37
38
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route-identity.d.ts","sourceRoot":"","sources":["../src/route-identity.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"route-identity.d.ts","sourceRoot":"","sources":["../src/route-identity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,uFAAuF;AACvF,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,wEAAwE;AACxE,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC;CACtB;AAED,kGAAkG;AAClG,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,eAAe,GAAG,SAAS,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAG3G;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,eAAe,GAAG,SAAS,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAOzF;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG;IAAE,EAAE,EAAE,IAAI,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAIrG"}
|
|
@@ -1,9 +1,16 @@
|
|
|
1
|
-
export type JcodeConnectorFailureCode = "model_prefix_rejected" | "model_refused" | "model_mismatch" | "private_state" | "readiness_timeout";
|
|
1
|
+
export type JcodeConnectorFailureCode = "model_prefix_rejected" | "model_refused" | "model_mismatch" | "private_state" | "readiness_timeout" | "sessions_enumeration_failed";
|
|
2
2
|
/** A bounded connector-owned startup refusal. Only its allow-listed code is rendered publicly. */
|
|
3
3
|
export declare class JcodeConnectorError extends Error {
|
|
4
4
|
readonly code: JcodeConnectorFailureCode;
|
|
5
5
|
constructor(code: JcodeConnectorFailureCode, message: string, options?: ErrorOptions);
|
|
6
6
|
}
|
|
7
|
+
/** Listing stored sessions killed the harness. Cause and path are connector-owned, not child stderr. */
|
|
8
|
+
export declare class JcodeSessionsEnumerationFailure extends Error {
|
|
9
|
+
readonly sessionsPath: string;
|
|
10
|
+
readonly causeText: string;
|
|
11
|
+
readonly code: "sessions_enumeration_failed";
|
|
12
|
+
constructor(sessionsPath: string, causeText: string);
|
|
13
|
+
}
|
|
7
14
|
/** Start the per-seat connector diagnostic log before any private Jcode process is launched. */
|
|
8
15
|
export declare function installJcodeDiagnosticLog(home: string): string;
|
|
9
16
|
/** Write one connector-owned diagnostic to the terminal and the seat's private connector log. */
|
|
@@ -23,21 +30,31 @@ export declare class JcodeReadinessProviderRefusal extends Error {
|
|
|
23
30
|
export declare class JcodeEffortRefusal extends Error {
|
|
24
31
|
readonly requestedTier: string;
|
|
25
32
|
readonly effectiveModel: string;
|
|
33
|
+
readonly provider: string;
|
|
34
|
+
readonly apiMethod: string | undefined;
|
|
26
35
|
readonly acceptedLadder: readonly string[];
|
|
27
36
|
readonly providerCode = "invalid_request";
|
|
28
|
-
constructor(requestedTier: string, effectiveModel: string, acceptedLadder: readonly string[]);
|
|
37
|
+
constructor(requestedTier: string, effectiveModel: string, provider: string, apiMethod: string | undefined, acceptedLadder: readonly string[]);
|
|
38
|
+
}
|
|
39
|
+
/** A verified model route whose provider/profile has no reasoning-effort surface. */
|
|
40
|
+
export declare class JcodeEffortUnsupported extends Error {
|
|
41
|
+
readonly requestedTier: string;
|
|
42
|
+
readonly effectiveModel: string;
|
|
43
|
+
readonly provider: string;
|
|
44
|
+
readonly apiMethod: string | undefined;
|
|
45
|
+
constructor(requestedTier: string, effectiveModel: string, provider: string, apiMethod: string | undefined);
|
|
29
46
|
}
|
|
30
47
|
/** Compose a bounded effort-refusal diagnostic. `invalid_request` is intentionally fixed: Jcode
|
|
31
48
|
* rejected this API operation, while provider-supplied codes and text are untrusted. */
|
|
32
|
-
export
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
*
|
|
39
|
-
*/
|
|
40
|
-
export declare function
|
|
49
|
+
export interface JcodeEffortIdentity {
|
|
50
|
+
model: string;
|
|
51
|
+
provider: string;
|
|
52
|
+
apiMethod?: string;
|
|
53
|
+
}
|
|
54
|
+
/** Classify the two stable invalid-request outcomes without rendering downstream text. HarnessError
|
|
55
|
+
* prefixes its message with the stable code, so the anchored `invalid_request:` predicate below is
|
|
56
|
+
* also the code gate; a second `error.code` check would be redundant. */
|
|
57
|
+
export declare function jcodeEffortRefusal(error: unknown, requestedTier: string, identity: JcodeEffortIdentity): JcodeEffortRefusal | JcodeEffortUnsupported;
|
|
41
58
|
/**
|
|
42
59
|
* Classify only the Jcode SDK's invalid-request response and only when both fields are safely
|
|
43
60
|
* extractable. Everything else retains the existing scrubbed startup diagnostic.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"startup-diagnostics.d.ts","sourceRoot":"","sources":["../src/startup-diagnostics.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,yBAAyB,GACj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,MAAM;IAC/B,QAAQ,CAAC,QAAQ,EAAE,MAAM;IACzB,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS;IACtC,QAAQ,CAAC,cAAc,EAAE,SAAS,MAAM,EAAE;IAP5C,QAAQ,CAAC,YAAY,qBAAqB;gBAG/B,aAAa,EAAE,MAAM,EACrB,cAAc,EAAE,MAAM,EACtB,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,cAAc,EAAE,SAAS,MAAM,EAAE;CAI7C;AAED,qFAAqF;AACrF,qBAAa,sBAAuB,SAAQ,KAAK;IAE7C,QAAQ,CAAC,aAAa,EAAE,MAAM;IAC9B,QAAQ,CAAC,cAAc,EAAE,MAAM;IAC/B,QAAQ,CAAC,QAAQ,EAAE,MAAM;IACzB,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS;gBAH7B,aAAa,EAAE,MAAM,EACrB,cAAc,EAAE,MAAM,EACtB,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,GAAG,SAAS;CAIzC;AAsDD;wFACwF;AACxF,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;yEAEyE;AACzE,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,OAAO,EACd,aAAa,EAAE,MAAM,EACrB,QAAQ,EAAE,mBAAmB,GAC5B,kBAAkB,GAAG,sBAAsB,CAc7C;AAED;;;GAGG;AACH,wBAAgB,gCAAgC,CAAC,KAAK,EAAE,OAAO,GAAG,6BAA6B,GAAG,SAAS,CAM1G"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export declare function storedSessionsPath(jcodeHome: string): string;
|
|
2
|
+
export type StoredSessionsInspection = {
|
|
3
|
+
kind: "absent";
|
|
4
|
+
path: string;
|
|
5
|
+
} | {
|
|
6
|
+
kind: "empty-directory";
|
|
7
|
+
path: string;
|
|
8
|
+
} | {
|
|
9
|
+
kind: "populated";
|
|
10
|
+
path: string;
|
|
11
|
+
entries: number;
|
|
12
|
+
} | {
|
|
13
|
+
kind: "not-a-directory";
|
|
14
|
+
path: string;
|
|
15
|
+
} | {
|
|
16
|
+
kind: "unreadable";
|
|
17
|
+
path: string;
|
|
18
|
+
code: string;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* A local read of the seat's own `sessions/` directory. This runs on the startup path of every
|
|
22
|
+
* managed seat, so it must never throw: a home the connector cannot read is a question for the
|
|
23
|
+
* harness, not a reason to kill a seat that would otherwise start. Both reads here can fail on a
|
|
24
|
+
* home whose permissions were perturbed from outside (operator chmod, restored backup, container
|
|
25
|
+
* UID remap): `lstat` when the home itself is unreadable, `readdir` when only `sessions/` is.
|
|
26
|
+
* Anything but a real empty directory falls through to the ordinary listing attempt.
|
|
27
|
+
*/
|
|
28
|
+
export declare function inspectStoredSessions(jcodeHome: string): StoredSessionsInspection;
|
|
29
|
+
/** True only for a real empty directory. A missing directory is a first launch, not this defect. */
|
|
30
|
+
export declare function isEmptyStoredSessionsDirectory(inspection: StoredSessionsInspection): boolean;
|
|
31
|
+
export declare function classifyStoredSessionPanic(stderr: string): string | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* Operator-facing cause: allow-listed phrases only, never arbitrary child bytes.
|
|
34
|
+
*
|
|
35
|
+
* The fallback is deliberately non-committal. Naming a specific cause for text we do not
|
|
36
|
+
* recognise sends the operator to the wrong place: an out-of-memory spawn failure rendered as
|
|
37
|
+
* "harness connection closed" points at sockets. An unrecognised cause is reported as such.
|
|
38
|
+
*/
|
|
39
|
+
export declare const UNRECOGNISED_STORED_SESSION_CAUSE = "unrecognised harness failure";
|
|
40
|
+
export declare function boundStoredSessionCause(text: string): string;
|
|
41
|
+
//# sourceMappingURL=stored-sessions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stored-sessions.d.ts","sourceRoot":"","sources":["../src/stored-sessions.ts"],"names":[],"mappings":"AAYA,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAE5D;AAED,MAAM,MAAM,wBAAwB,GAChC;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAChC;IAAE,IAAI,EAAE,iBAAiB,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACzC;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GACpD;IAAE,IAAI,EAAE,iBAAiB,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACzC;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAEvD;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,MAAM,GAAG,wBAAwB,CAajF;AAED,oGAAoG;AACpG,wBAAgB,8BAA8B,CAAC,UAAU,EAAE,wBAAwB,GAAG,OAAO,CAE5F;AAaD,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAG7E;AAED;;;;;;GAMG;AACH,eAAO,MAAM,iCAAiC,iCAAiC,CAAC;AAEhF,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAK5D"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cotal-ai/connector-jcode",
|
|
3
3
|
"description": "Cotal connector for Jcode: a host-mode mesh peer driven through Jcode's Harness API bridge.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.49.0",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
"esbuild": "^0.28.0",
|
|
30
30
|
"tsx": "^4.22.4",
|
|
31
31
|
"zod": "^4.4.3",
|
|
32
|
-
"@cotal-ai/core": "0.
|
|
33
|
-
"@cotal-ai/
|
|
34
|
-
"@cotal-ai/
|
|
32
|
+
"@cotal-ai/connector-core": "0.49.0",
|
|
33
|
+
"@cotal-ai/core": "0.49.0",
|
|
34
|
+
"@cotal-ai/smoke-kit": "0.0.0"
|
|
35
35
|
},
|
|
36
36
|
"files": [
|
|
37
37
|
"dist"
|