@intentic/sandbox-contract 1.245.0 → 1.246.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/README.md +17 -1
- package/dist/command-classes.d.ts +6 -3
- package/dist/command-classes.d.ts.map +1 -1
- package/dist/command-classes.js +43 -18
- package/dist/command-classes.js.map +1 -1
- package/dist/contracts/{cursor.contract.d.ts → accounts.contract.d.ts} +102 -3
- package/dist/contracts/accounts.contract.d.ts.map +1 -0
- package/dist/contracts/accounts.contract.js +61 -0
- package/dist/contracts/accounts.contract.js.map +1 -0
- package/dist/contracts/agents.contract.d.ts +121 -0
- package/dist/contracts/agents.contract.d.ts.map +1 -1
- package/dist/contracts/agents.contract.js +4 -4
- package/dist/contracts/agents.contract.js.map +1 -1
- package/dist/contracts/ci.contract.d.ts +2 -0
- package/dist/contracts/ci.contract.d.ts.map +1 -1
- package/dist/contracts/host.contract.d.ts +35 -0
- package/dist/contracts/host.contract.d.ts.map +1 -1
- package/dist/contracts/host.contract.js +3 -2
- package/dist/contracts/host.contract.js.map +1 -1
- package/dist/contracts/personas.contract.d.ts +4 -2
- package/dist/contracts/personas.contract.d.ts.map +1 -1
- package/dist/contracts/runner.contract.d.ts +2 -2
- package/dist/contracts/settings.contract.d.ts +2 -51
- package/dist/contracts/settings.contract.d.ts.map +1 -1
- package/dist/contracts/system.contract.d.ts +80 -30
- package/dist/contracts/system.contract.d.ts.map +1 -1
- package/dist/contracts/system.contract.js +26 -17
- package/dist/contracts/system.contract.js.map +1 -1
- package/dist/definition.d.ts +4 -8
- package/dist/definition.d.ts.map +1 -1
- package/dist/documents.d.ts +0 -1
- package/dist/documents.d.ts.map +1 -1
- package/dist/documents.js +1 -2
- package/dist/documents.js.map +1 -1
- package/dist/embed.d.ts +23 -0
- package/dist/embed.d.ts.map +1 -0
- package/dist/embed.js +84 -0
- package/dist/embed.js.map +1 -0
- package/dist/events.d.ts +21 -0
- package/dist/events.d.ts.map +1 -1
- package/dist/events.js +5 -2
- package/dist/events.js.map +1 -1
- package/dist/history-state.d.ts.map +1 -1
- package/dist/history-state.js +2 -0
- package/dist/history-state.js.map +1 -1
- package/dist/index.d.ts +354 -335
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -13
- package/dist/index.js.map +1 -1
- package/dist/peer-dial.d.ts +33 -0
- package/dist/peer-dial.d.ts.map +1 -0
- package/dist/peer-dial.js +79 -0
- package/dist/peer-dial.js.map +1 -0
- package/dist/peer-mcp-server.d.ts +36 -0
- package/dist/peer-mcp-server.d.ts.map +1 -0
- package/dist/peer-mcp-server.js +71 -0
- package/dist/peer-mcp-server.js.map +1 -0
- package/dist/provider-specs.d.ts +38 -20
- package/dist/provider-specs.d.ts.map +1 -1
- package/dist/provider-specs.js +39 -13
- package/dist/provider-specs.js.map +1 -1
- package/dist/quick-model.d.ts.map +1 -1
- package/dist/quick-model.js +2 -1
- package/dist/quick-model.js.map +1 -1
- package/dist/runtime-state.d.ts +1 -1
- package/dist/runtime-state.js +1 -1
- package/dist/runtime-state.js.map +1 -1
- package/dist/safety-policy.d.ts +12 -3
- package/dist/safety-policy.d.ts.map +1 -1
- package/dist/safety-policy.js +30 -5
- package/dist/safety-policy.js.map +1 -1
- package/dist/schemas/agent.d.ts +6 -6
- package/dist/schemas/agent.d.ts.map +1 -1
- package/dist/schemas/agent.js +6 -2
- package/dist/schemas/agent.js.map +1 -1
- package/dist/schemas/agents.d.ts +42 -0
- package/dist/schemas/agents.d.ts.map +1 -1
- package/dist/schemas/agents.js +25 -4
- package/dist/schemas/agents.js.map +1 -1
- package/dist/schemas/automations.d.ts +11 -2
- package/dist/schemas/automations.d.ts.map +1 -1
- package/dist/schemas/automations.js +1 -1
- package/dist/schemas/automations.js.map +1 -1
- package/dist/schemas/ci.d.ts +6 -0
- package/dist/schemas/ci.d.ts.map +1 -1
- package/dist/schemas/ci.js +3 -2
- package/dist/schemas/ci.js.map +1 -1
- package/dist/schemas/context.d.ts +30 -0
- package/dist/schemas/context.d.ts.map +1 -0
- package/dist/schemas/context.js +34 -0
- package/dist/schemas/context.js.map +1 -0
- package/dist/schemas/{computers.d.ts → devices.d.ts} +154 -60
- package/dist/schemas/devices.d.ts.map +1 -0
- package/dist/schemas/devices.js +157 -0
- package/dist/schemas/devices.js.map +1 -0
- package/dist/schemas/hosts.d.ts +12 -0
- package/dist/schemas/hosts.d.ts.map +1 -1
- package/dist/schemas/hosts.js +1 -0
- package/dist/schemas/hosts.js.map +1 -1
- package/dist/schemas/issues.d.ts +0 -5
- package/dist/schemas/issues.d.ts.map +1 -1
- package/dist/schemas/issues.js +0 -1
- package/dist/schemas/issues.js.map +1 -1
- package/dist/schemas/personas.d.ts +5 -3
- package/dist/schemas/personas.d.ts.map +1 -1
- package/dist/schemas/personas.js +3 -2
- package/dist/schemas/personas.js.map +1 -1
- package/dist/schemas/provider-oauth.d.ts +48 -16
- package/dist/schemas/provider-oauth.d.ts.map +1 -1
- package/dist/schemas/provider-oauth.js +22 -20
- package/dist/schemas/provider-oauth.js.map +1 -1
- package/dist/schemas/settings.d.ts +1 -52
- package/dist/schemas/settings.d.ts.map +1 -1
- package/dist/schemas/settings.js +8 -11
- package/dist/schemas/settings.js.map +1 -1
- package/dist/schemas/terminal.js +9 -9
- package/dist/schemas/terminal.js.map +1 -1
- package/dist/schemas/usage.d.ts +0 -2
- package/dist/schemas/usage.d.ts.map +1 -1
- package/dist/schemas/usage.js +0 -2
- package/dist/schemas/usage.js.map +1 -1
- package/dist/shell-regions.d.ts +4 -0
- package/dist/shell-regions.d.ts.map +1 -0
- package/dist/shell-regions.js +156 -0
- package/dist/shell-regions.js.map +1 -0
- package/dist/workspace-state.d.ts +8 -0
- package/dist/workspace-state.d.ts.map +1 -1
- package/dist/workspace-state.js +13 -5
- package/dist/workspace-state.js.map +1 -1
- package/package.json +37 -4
- package/src/agent-catalog.ts +1 -1
- package/src/arrival.ts +3 -3
- package/src/command-classes.test.ts +195 -71
- package/src/command-classes.ts +148 -46
- package/src/contracts/accounts.contract.ts +94 -0
- package/src/contracts/agents.contract.ts +4 -3
- package/src/contracts/exit.contract.ts +2 -2
- package/src/contracts/host.contract.ts +17 -5
- package/src/contracts/settings.contract.ts +1 -1
- package/src/contracts/system.contract.ts +43 -24
- package/src/contracts/vpn.contract.ts +2 -2
- package/src/documents.test.ts +2 -1
- package/src/documents.ts +7 -11
- package/src/embed.test.ts +68 -0
- package/src/embed.ts +164 -0
- package/src/events.ts +30 -3
- package/src/history-state.ts +12 -3
- package/src/host-protocol.ts +2 -2
- package/src/index.ts +6 -14
- package/src/model-order.ts +1 -1
- package/src/peer-dial.test.ts +203 -0
- package/src/peer-dial.ts +163 -0
- package/src/peer-mcp-server.test.ts +104 -0
- package/src/peer-mcp-server.ts +144 -0
- package/src/provider-specs.test.ts +44 -17
- package/src/provider-specs.ts +147 -67
- package/src/quick-model.ts +10 -3
- package/src/routes.test.ts +6 -3
- package/src/runner-protocol.ts +1 -1
- package/src/runtime-state.ts +2 -2
- package/src/safety-policy.test.ts +88 -0
- package/src/safety-policy.ts +84 -14
- package/src/schemas/agent.ts +41 -13
- package/src/schemas/agents.ts +65 -4
- package/src/schemas/automations.ts +6 -4
- package/src/schemas/capabilities.ts +4 -4
- package/src/schemas/ci.ts +23 -6
- package/src/schemas/context.ts +87 -0
- package/src/schemas/{computers.ts → devices.ts} +190 -107
- package/src/schemas/hosts.ts +5 -1
- package/src/schemas/issues.ts +0 -4
- package/src/schemas/personas.ts +8 -3
- package/src/schemas/provider-oauth.ts +49 -52
- package/src/schemas/settings.ts +30 -54
- package/src/schemas/terminal.ts +12 -12
- package/src/schemas/usage.ts +3 -27
- package/src/schemas/version-seam.test.ts +0 -1
- package/src/shell-regions.ts +289 -0
- package/src/versions.ts +2 -2
- package/src/webext-links.ts +2 -2
- package/src/webext-protocol.ts +2 -2
- package/src/workspace-state.test.ts +48 -1
- package/src/workspace-state.ts +48 -11
- package/dist/contracts/claude.contract.d.ts +0 -91
- package/dist/contracts/claude.contract.d.ts.map +0 -1
- package/dist/contracts/claude.contract.js +0 -50
- package/dist/contracts/claude.contract.js.map +0 -1
- package/dist/contracts/cursor.contract.d.ts.map +0 -1
- package/dist/contracts/cursor.contract.js +0 -50
- package/dist/contracts/cursor.contract.js.map +0 -1
- package/dist/contracts/grok.contract.d.ts +0 -36
- package/dist/contracts/grok.contract.d.ts.map +0 -1
- package/dist/contracts/grok.contract.js +0 -31
- package/dist/contracts/grok.contract.js.map +0 -1
- package/dist/contracts/keys.contract.d.ts +0 -81
- package/dist/contracts/keys.contract.d.ts.map +0 -1
- package/dist/contracts/keys.contract.js +0 -51
- package/dist/contracts/keys.contract.js.map +0 -1
- package/dist/schemas/computers.d.ts.map +0 -1
- package/dist/schemas/computers.js +0 -135
- package/dist/schemas/computers.js.map +0 -1
- package/src/contracts/claude.contract.ts +0 -71
- package/src/contracts/cursor.contract.ts +0 -74
- package/src/contracts/grok.contract.ts +0 -41
- package/src/contracts/keys.contract.ts +0 -79
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
// context: which part of the workspace a conversation carries
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { entryId } from "./internal.js";
|
|
4
|
+
|
|
5
|
+
/* A CONVERSATION SEES A CHOSEN PART OF THE WORKSPACE, and these three schemas are how the choice is spelled.
|
|
6
|
+
*
|
|
7
|
+
* A workspace grows into more than any one session should open on: dozens of repositories, hundreds of skills,
|
|
8
|
+
* a shelf of reference clones. Every conversation used to get all of it, one worktree per repository, frozen at
|
|
9
|
+
* its first turn (sandbox agents/worktrees.ts). The cost is paid twice, in checkouts nobody reads and in a
|
|
10
|
+
* project map and a skill listing that describe everything to a session that needs a corner of it
|
|
11
|
+
* (docs/context-composition-plan.md at the workspace root measures both).
|
|
12
|
+
*
|
|
13
|
+
* THREE WORDS. A SHELF is what the owner writes: the items a session MAY take, in the order they are loaded and,
|
|
14
|
+
* when a cap bites, shed from the tail. A COMPOSITION is the pick for one conversation, a list of item ids in
|
|
15
|
+
* shelf order, stored on its registry entry. An ITEM ID names one thing in the workspace, `<kind>:<name>`.
|
|
16
|
+
*
|
|
17
|
+
* ONE KIND TODAY, `repo:`, which is the whole of what a composition can make real: a repository is in the
|
|
18
|
+
* conversation (a worktree of it exists) or it is not (the directory does not exist). The grammar takes a kind
|
|
19
|
+
* prefix so the next ones (a directory inside a repository through a sparse cone, a skill folder, a reference
|
|
20
|
+
* shelf entry, a capability) widen this list and change nothing else. The root repository is never an item: it
|
|
21
|
+
* is the workspace itself and every conversation stands in it. */
|
|
22
|
+
export const CONTEXT_ITEM_KINDS = ["repo"] as const;
|
|
23
|
+
export type ContextItemKind = (typeof CONTEXT_ITEM_KINDS)[number];
|
|
24
|
+
|
|
25
|
+
/* `<kind>:<name>`. The name is a workspace-relative path or an id: safe segments, no `..`, no empty segment, so
|
|
26
|
+
* joining it under a root can never escape, the same shape repo-discovery.ts accepts for a repo id. */
|
|
27
|
+
const ITEM = /^(repo):[a-zA-Z0-9][a-zA-Z0-9._-]*(\/[a-zA-Z0-9][a-zA-Z0-9._-]*)*$/;
|
|
28
|
+
export const ContextItemIdSchema = z
|
|
29
|
+
.string()
|
|
30
|
+
.min(1)
|
|
31
|
+
.max(200)
|
|
32
|
+
.regex(ITEM)
|
|
33
|
+
.describe("One thing in the workspace a conversation can carry, as `<kind>:<name>`. Today the kind is `repo` and the name is a repository's workspace-relative path.");
|
|
34
|
+
export type ContextItemId = z.infer<typeof ContextItemIdSchema>;
|
|
35
|
+
|
|
36
|
+
// The two halves of an id, for the code that has to act on the name. The schema above already proved the shape.
|
|
37
|
+
export const contextItem = (id: ContextItemId): { readonly kind: ContextItemKind; readonly name: string } => {
|
|
38
|
+
const at = id.indexOf(":");
|
|
39
|
+
return { kind: id.slice(0, at) as ContextItemKind, name: id.slice(at + 1) };
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
/* HOW MANY OF EACH KIND A COMPOSITION MAY HOLD. Counted per kind because the kinds cost differently: a repository
|
|
43
|
+
* is a checkout, a skill is a line in every prompt. Absent means no limit. A pinned item is never shed to meet
|
|
44
|
+
* a cap: `pinned` is the owner saying "always", and a cap that could override it would make two fields disagree
|
|
45
|
+
* about the same item. */
|
|
46
|
+
export const ContextCapsSchema = z.object({
|
|
47
|
+
repos: z.number().int().min(0).optional().describe("How many repositories a composition may hold. Absent means as many as the shelf allows."),
|
|
48
|
+
});
|
|
49
|
+
export type ContextCaps = z.infer<typeof ContextCapsSchema>;
|
|
50
|
+
|
|
51
|
+
/* WHAT A SESSION MAY TAKE, in the owner's order. One file per shelf under `.intentic/config/context/<id>.json`,
|
|
52
|
+
* tracked and carried like a persona card (workspace-state.ts), for the same reason: a shelf is a list of
|
|
53
|
+
* names, holds no credential, and belongs in a pull request.
|
|
54
|
+
*
|
|
55
|
+
* `allowed` IS ORDERED, and the order is the only priority there is: it is what a curator is shown, the order
|
|
56
|
+
* items are loaded, and the order they are shed from the tail when a cap is hit. The owner fixes the order and
|
|
57
|
+
* the ceiling; whoever picks (a model, a person on the card, the shelf itself when nobody picks) decides
|
|
58
|
+
* membership and nothing else.
|
|
59
|
+
*
|
|
60
|
+
* `pinned` is always in, whether or not it is also listed in `allowed`. `denied` wins over everything, including
|
|
61
|
+
* a pinned item, so a shelf that inherits a list it did not write can still take one thing off it. */
|
|
62
|
+
export const ContextShelfSchema = z.object({
|
|
63
|
+
id: entryId.describe("The shelf's id, which is also its file name."),
|
|
64
|
+
label: z.string().max(60).optional().describe("What to call it on screen. Absent falls back to the id."),
|
|
65
|
+
pinned: z.array(ContextItemIdSchema).max(200).default([]).describe("Items every composition from this shelf carries."),
|
|
66
|
+
allowed: z
|
|
67
|
+
.array(ContextItemIdSchema)
|
|
68
|
+
.max(500)
|
|
69
|
+
.default([])
|
|
70
|
+
.describe("Items a composition may carry, in the order they are loaded and shed. The order is the priority; nothing else is."),
|
|
71
|
+
denied: z.array(ContextItemIdSchema).max(200).default([]).describe("Items no composition from this shelf carries, whatever else says so."),
|
|
72
|
+
caps: ContextCapsSchema.optional().describe("How many of each kind a composition may hold."),
|
|
73
|
+
});
|
|
74
|
+
export type ContextShelf = z.infer<typeof ContextShelfSchema>;
|
|
75
|
+
|
|
76
|
+
/* THE PICK FOR ONE CONVERSATION, on its registry entry beside the worktree composition it decides.
|
|
77
|
+
*
|
|
78
|
+
* `items` is exactly what the conversation carries, in shelf order, and the root repository besides. A
|
|
79
|
+
* conversation whose entry has NO composition carries everything the workspace has, which is what every
|
|
80
|
+
* conversation did before shelves existed and what a conversation opened with no shelf still does. Those two
|
|
81
|
+
* are one state on purpose: the absence is the answer, and a stored "everything" would be a second spelling of
|
|
82
|
+
* it that could disagree with the first. */
|
|
83
|
+
export const ContextCompositionSchema = z.object({
|
|
84
|
+
shelf: entryId.optional().describe("Which shelf this pick was made from. Absent when the items were set without one."),
|
|
85
|
+
items: z.array(ContextItemIdSchema).max(500).describe("What the conversation carries, in shelf order. The root repository is always carried and never listed."),
|
|
86
|
+
});
|
|
87
|
+
export type ContextComposition = z.infer<typeof ContextCompositionSchema>;
|