@otium-team/negotium 0.23.11 → 0.23.14
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 +8 -0
- package/dist/agent-helpers.js +821 -1516
- package/dist/agent-helpers.js.map +22 -21
- package/dist/background-bash.js +48 -19
- package/dist/background-bash.js.map +6 -5
- package/dist/browser-runtime.js +96 -69
- package/dist/browser-runtime.js.map +6 -5
- package/dist/canonical-mcp-bridge.js +8 -9
- package/dist/canonical-mcp-bridge.js.map +1 -1
- package/dist/{chunk-0fenxbe6.js → chunk-3v58ejrk.js} +4 -5
- package/dist/{chunk-0fenxbe6.js.map → chunk-3v58ejrk.js.map} +2 -2
- package/dist/chunk-d1c2wt8q.js +83 -0
- package/dist/{chunk-ad7kxsaq.js.map → chunk-d1c2wt8q.js.map} +1 -1
- package/dist/{chunk-jtv8yzy1.js → chunk-m1ngkjdd.js} +12 -12
- package/dist/{chunk-jtv8yzy1.js.map → chunk-m1ngkjdd.js.map} +2 -2
- package/dist/{chunk-da9ad838.js → chunk-ng13grfj.js} +180 -152
- package/dist/{chunk-da9ad838.js.map → chunk-ng13grfj.js.map} +11 -10
- package/dist/{chunk-mxxwx5mg.js → chunk-pesnv5zv.js} +134 -143
- package/dist/chunk-pesnv5zv.js.map +14 -0
- package/dist/{chunk-f7p0h1gs.js → chunk-ww8a4ej4.js} +5 -5
- package/dist/{chunk-f7p0h1gs.js.map → chunk-ww8a4ej4.js.map} +2 -2
- package/dist/hosted-agent.js +204 -136
- package/dist/hosted-agent.js.map +7 -7
- package/dist/main.js +4340 -4529
- package/dist/main.js.map +31 -28
- package/dist/mcp-catalog.js +4 -4
- package/dist/mcp-catalog.js.map +1 -1
- package/dist/mcp-factories.js +1080 -1767
- package/dist/mcp-factories.js.map +21 -20
- package/dist/mcp-servers.js +5 -5
- package/dist/mcp-servers.js.map +1 -1
- package/dist/media.js +42 -13
- package/dist/media.js.map +6 -5
- package/dist/outbox.js +15 -15
- package/dist/outbox.js.map +2 -2
- package/dist/platform-runtime.js +7 -7
- package/dist/platform-runtime.js.map +1 -1
- package/dist/prompts.js +74 -15
- package/dist/prompts.js.map +8 -7
- package/dist/query-runtime.js +57 -30
- package/dist/query-runtime.js.map +7 -6
- package/dist/registry.js +22 -21
- package/dist/registry.js.map +3 -3
- package/dist/rollout.js +41 -41
- package/dist/rollout.js.map +2 -2
- package/dist/runtime/src/agents/claude-provider.ts +80 -5
- package/dist/runtime/src/agents/claude-registry.ts +2 -1
- package/dist/runtime/src/agents/explicit-agent-switch.ts +1 -1
- package/dist/runtime/src/agents/mcp-tools/self-config.ts +1 -1
- package/dist/runtime/src/agents/mcp-tools/spawn-subagent.ts +9 -1
- package/dist/runtime/src/agents/model-catalog.ts +13 -0
- package/dist/runtime/src/application/submit-runtime-gateway-turn.ts +84 -20
- package/dist/runtime/src/application/topic-service.ts +6 -2
- package/dist/runtime/src/application/turn-follow-ups.ts +291 -0
- package/dist/runtime/src/bus.ts +6 -0
- package/dist/runtime/src/node-host.ts +11 -0
- package/dist/runtime/src/platform/browser-backend.ts +73 -0
- package/dist/runtime/src/platform/config.ts +3 -0
- package/dist/runtime/src/platform/mcp-config.ts +3 -0
- package/dist/runtime/src/prompts/builders.ts +11 -2
- package/dist/runtime/src/prompts/sessions/_shared-tools.md +2 -0
- package/dist/runtime/src/query/active-rooms.ts +7 -1
- package/dist/runtime/src/runtime/turn-event-stream.ts +34 -6
- package/dist/runtime/src/runtime/turn-runner.ts +54 -9
- package/dist/runtime/src/runtime-gateway.ts +198 -1
- package/dist/runtime/src/storage/runtime-follow-ups.ts +212 -0
- package/dist/runtime/src/storage/runtime-turn-requests.ts +43 -2
- package/dist/runtime/src/storage/token-stats.ts +4 -0
- package/dist/runtime/src/types/api.ts +9 -0
- package/dist/runtime/src/types.ts +23 -0
- package/dist/runtime/src/version.ts +1 -1
- package/dist/runtime-gateway.js +73 -12
- package/dist/runtime-gateway.js.map +3 -3
- package/dist/runtime-helpers.js +107 -80
- package/dist/runtime-helpers.js.map +6 -5
- package/dist/sqlite.js +3 -5
- package/dist/sqlite.js.map +2 -2
- package/dist/storage.js +4843 -4812
- package/dist/storage.js.map +4 -4
- package/dist/types/packages/core/src/bus.d.ts +3 -0
- package/dist/types/packages/core/src/platform/browser-backend.d.ts +8 -0
- package/dist/types/packages/core/src/platform/config.d.ts +2 -0
- package/dist/types/packages/core/src/query/active-rooms.d.ts +7 -1
- package/dist/types/packages/core/src/runtime-gateway.d.ts +59 -1
- package/dist/types/packages/core/src/storage/runtime-turn-requests.d.ts +25 -0
- package/dist/types/packages/core/src/types/api.d.ts +5 -0
- package/dist/types/packages/core/src/types.d.ts +21 -0
- package/dist/types/packages/core/src/version.d.ts +1 -1
- package/dist/vault.js +64 -37
- package/dist/vault.js.map +6 -5
- package/package.json +1 -1
- package/dist/chunk-2mx7fq49.js +0 -6
- package/dist/chunk-2mx7fq49.js.map +0 -9
- package/dist/chunk-ad7kxsaq.js +0 -202
- package/dist/chunk-mxxwx5mg.js.map +0 -13
|
@@ -70,6 +70,7 @@ export interface RuntimeBus {
|
|
|
70
70
|
}): void;
|
|
71
71
|
broadcastError(topicId: string, queryId: string, error: string): void;
|
|
72
72
|
broadcastTopicNotice(topicId: string, severity: "info" | "warning" | "error", label: string): void;
|
|
73
|
+
broadcastMidTurnRead(topicId: string, queryId: string, messageIds: readonly string[]): void;
|
|
73
74
|
broadcastAborted(topicId: string, queryId: string, reason?: "superseded" | "stopped"): void;
|
|
74
75
|
broadcastToolCall(topicId: string, queryId: string, name: string, input: ToolCallSummaryInput | undefined, label: string, toolUseId: string): void;
|
|
75
76
|
broadcastToolOutput(topicId: string, queryId: string, toolUseId: string, content: string, isError?: boolean): void;
|
|
@@ -117,6 +118,8 @@ export declare class SqliteRuntimeBus implements RuntimeBus {
|
|
|
117
118
|
}): void;
|
|
118
119
|
broadcastError(topicId: string, queryId: string, error: string): void;
|
|
119
120
|
broadcastTopicNotice(topicId: string, severity: "info" | "warning" | "error", label: string): void;
|
|
121
|
+
/** The running turn read these messages the person sent while it worked. */
|
|
122
|
+
broadcastMidTurnRead(topicId: string, queryId: string, messageIds: readonly string[]): void;
|
|
120
123
|
broadcastAborted(topicId: string, queryId: string, reason?: "superseded" | "stopped"): void;
|
|
121
124
|
broadcastToolCall(topicId: string, queryId: string, name: string, input: ToolCallSummaryInput | undefined, label: string, toolUseId: string): void;
|
|
122
125
|
broadcastToolOutput(topicId: string, queryId: string, toolUseId: string, content: string, isError?: boolean): void;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type BrowserBackend = "chrome" | "egolite";
|
|
2
|
+
/** Resolve once at node startup; explicit overrides never depend on local discovery. */
|
|
3
|
+
export declare function resolveBrowserBackend(value?: string, findEgoBrowser?: () => string | undefined): BrowserBackend;
|
|
4
|
+
/** Search executable locations only; never resolve a tool from the topic's cwd. */
|
|
5
|
+
export declare function resolveEgoBrowserBin(path?: string, home?: string): string | undefined;
|
|
6
|
+
/** Probe the CLI without opening a browser, changing profiles, or importing user data. */
|
|
7
|
+
export declare function prepareEgoBrowser(): Promise<string>;
|
|
8
|
+
export declare const EGO_BROWSER_INSTRUCTIONS = "## Browser\nThis node uses ego lite through the official ego-browser CLI, using its existing logged-in browser.\nThe Chrome browser_* MCP tools are not registered. Never start browser-rs, point AB_CHROME at ego lite,\nattach to its debugging port, or create a replacement browser/profile.\nUse browser automation only when this turn's runtime reminder authorizes it. If it is unavailable or\nthe topic owner check denies access, do not bypass that decision through a shell or another tool.\nWhen authorized, use the executable supplied by the runtime through your foreground shell tool.\nBefore the first browser action in a session, run that executable with \"skill\" and read its entire\ninstalled-version guide. Use its \"nodejs\" command and documented APIs; do not assume Playwright APIs.\nCreate one task space for the user goal and retain its spaceId across commands and follow-up turns.\nUse a unique task name tied to this topic and goal; never claim another topic's or a user's space\nwithout explicit authorization. Existing login state is shared, not the user's other task spaces.\nStop when the user takes control. Hand off authentication to the user and resume the same task space\nonly after confirmation. On successful completion, call finish({ keep: [] }) unless the user needs\nspecific result tabs. On interruption, preserve the space for resumption; never kill the browser or\ndelete its profile. Do not close a space just because an AI turn ended.\nVerify each action through the guide's observation APIs. Report CLI/browser errors as errors and do\nnot silently switch to Chrome. The CLI probe does not prove the browser is connected or authenticated.\nVault secret injection through browser-rs is not available here; do not copy secrets into scripts or logs.";
|
|
@@ -7,6 +7,7 @@ export declare const TOPIC_WORKSPACE_DIR: string;
|
|
|
7
7
|
export declare const SHARED_WIKI_DIR: string;
|
|
8
8
|
export declare const CRON_WORKSPACE_DIR: string;
|
|
9
9
|
export declare const BROWSER_DIR: string;
|
|
10
|
+
export declare const BROWSER_BACKEND: import("./browser-backend").BrowserBackend;
|
|
10
11
|
export declare const BROWSER_PROFILES_DIR: string;
|
|
11
12
|
export declare const BINARIES_DIR: string;
|
|
12
13
|
export declare const SECRETS_DIR: string;
|
|
@@ -140,6 +141,7 @@ export declare const MODEL_SONNET = "claude-sonnet-5";
|
|
|
140
141
|
export declare const MODEL_OPUS = "claude-opus-5-5";
|
|
141
142
|
export declare const MODEL_HAIKU = "claude-haiku-4-5-20251001";
|
|
142
143
|
export declare const MODEL_FABLE = "claude-fable-5-1";
|
|
144
|
+
export declare const MODEL_FABLE_5_2 = "claude-fable-5-2";
|
|
143
145
|
export declare const MODEL_DEEPSEEK_V4_PRO = "deepseek-v4-pro";
|
|
144
146
|
export declare const MODEL_DEEPSEEK_V4_FLASH = "deepseek-v4-flash";
|
|
145
147
|
export declare const FALLBACK_AGENT: AgentKind;
|
|
@@ -16,7 +16,7 @@ import type { ForkHandle } from "../agents/fork";
|
|
|
16
16
|
import type { UserTurnEnvelope } from "../runtime/user-turn-envelope";
|
|
17
17
|
import { type RuntimeTurnLease } from "../storage/runtime-leases";
|
|
18
18
|
import type { AskReplySource } from "../storage/session-asks";
|
|
19
|
-
import type { AgentKind, PeerRuntimeBridgeContext } from "../types";
|
|
19
|
+
import type { AgentKind, MidTurnMessage, PeerRuntimeBridgeContext } from "../types";
|
|
20
20
|
import { type RoomQueryDecision } from "./room-query-registry";
|
|
21
21
|
import { AbortReason } from "./types";
|
|
22
22
|
export { isolatedTurnRoomId, isUserOrigin } from "./room-query-registry";
|
|
@@ -135,6 +135,12 @@ export interface RoomQueryControl {
|
|
|
135
135
|
injectParams?: DeferredInject;
|
|
136
136
|
/** True only after this process successfully queued a local replay. */
|
|
137
137
|
injectRequeued?: boolean;
|
|
138
|
+
/**
|
|
139
|
+
* Set while this turn's provider takes messages mid-turn: hands it a message
|
|
140
|
+
* the same person sent, whose queued row is `requestId`. False when the turn
|
|
141
|
+
* can no longer take it, and the row then runs as the next turn.
|
|
142
|
+
*/
|
|
143
|
+
deliverMidTurn?: (message: MidTurnMessage, requestId: string) => boolean;
|
|
138
144
|
}
|
|
139
145
|
export declare function getRoomQuery(roomId: string): RoomQueryControl | undefined;
|
|
140
146
|
/** Topic ids and query ids with an in-flight turn in this or another runtime process. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ActorTopicScope, RemoteSessionGrant } from "./types";
|
|
2
|
-
import type { MessageDto } from "./types/api";
|
|
2
|
+
import type { AttachmentDto, MessageDto } from "./types/api";
|
|
3
3
|
export declare const RUNTIME_GATEWAY_VERSION: 1;
|
|
4
4
|
export declare const RUNTIME_GATEWAY_CONTROL_PATH = "/api/v1/control/runtime/v1";
|
|
5
5
|
export type RuntimeGatewayErrorKind = "config" | "timeout" | "transport" | "protocol" | "http";
|
|
@@ -67,6 +67,20 @@ export interface RuntimeGatewayTurnInput {
|
|
|
67
67
|
* resumes with the merged batch; `false` queues this message behind it.
|
|
68
68
|
*/
|
|
69
69
|
steer?: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* While a turn from the same person runs: deliver this message into it, read
|
|
72
|
+
* after the step it is on, and the work goes on (Codex-style steer). Wins over
|
|
73
|
+
* `steer`; when the turn cannot take it, the message is queued behind it. A
|
|
74
|
+
* node too old for this ignores the field, so send `steer: false` with it.
|
|
75
|
+
*/
|
|
76
|
+
inject?: boolean;
|
|
77
|
+
/**
|
|
78
|
+
* While the room works, hold this message as a follow-up instead of queuing
|
|
79
|
+
* a turn (`turn-follow-ups` capability; use `holdOrSubmitTurn`). Held, it
|
|
80
|
+
* is not in the transcript and can be edited, moved, deleted or sent now; the
|
|
81
|
+
* node sends held follow-ups one per turn once the room is idle.
|
|
82
|
+
*/
|
|
83
|
+
hold?: boolean;
|
|
70
84
|
/** Run without adding the injected prompt or output to the visible transcript. */
|
|
71
85
|
silent?: boolean;
|
|
72
86
|
attachments?: string[];
|
|
@@ -88,6 +102,35 @@ export interface RuntimeGatewayTurnAcknowledgement {
|
|
|
88
102
|
message?: MessageDto;
|
|
89
103
|
cursor: number;
|
|
90
104
|
}
|
|
105
|
+
/** A message held while the room worked (`turn-follow-ups`). */
|
|
106
|
+
export interface RuntimeGatewayFollowUp {
|
|
107
|
+
id: string;
|
|
108
|
+
text: string;
|
|
109
|
+
actorUserId: string;
|
|
110
|
+
attachments: AttachmentDto[];
|
|
111
|
+
createdAt: string;
|
|
112
|
+
}
|
|
113
|
+
/** A room's held follow-ups, oldest first, and whether they wait after a stop. */
|
|
114
|
+
export interface RuntimeGatewayFollowUpLine {
|
|
115
|
+
topicId: string;
|
|
116
|
+
followUps: RuntimeGatewayFollowUp[];
|
|
117
|
+
paused: boolean;
|
|
118
|
+
}
|
|
119
|
+
export interface RuntimeGatewayHeldTurn {
|
|
120
|
+
ok: true;
|
|
121
|
+
v: typeof RUNTIME_GATEWAY_VERSION;
|
|
122
|
+
accepted: true;
|
|
123
|
+
held: true;
|
|
124
|
+
clientMessageId: string;
|
|
125
|
+
topicId: string;
|
|
126
|
+
followUp: RuntimeGatewayFollowUp;
|
|
127
|
+
}
|
|
128
|
+
export interface RuntimeGatewayFollowUpActor {
|
|
129
|
+
/** Canonical principal on the execution node. */
|
|
130
|
+
userId: string;
|
|
131
|
+
/** The person who sent it; only they may change it. Defaults to `userId`. */
|
|
132
|
+
actorUserId?: string;
|
|
133
|
+
}
|
|
91
134
|
export interface RuntimeGatewayTopicDeriveInput {
|
|
92
135
|
userId: string;
|
|
93
136
|
copyHistory: boolean;
|
|
@@ -206,6 +249,21 @@ export declare class RuntimeGatewayClient {
|
|
|
206
249
|
private send;
|
|
207
250
|
health(): Promise<RuntimeGatewayHealth>;
|
|
208
251
|
submitTurn(input: RuntimeGatewayTurnInput): Promise<RuntimeGatewayTurnAcknowledgement>;
|
|
252
|
+
/**
|
|
253
|
+
* `submitTurn` with `hold: true`: while the room works the node holds the
|
|
254
|
+
* message as a follow-up and answers with it; otherwise it is a turn as usual.
|
|
255
|
+
*/
|
|
256
|
+
holdOrSubmitTurn(input: RuntimeGatewayTurnInput): Promise<RuntimeGatewayTurnAcknowledgement | RuntimeGatewayHeldTurn>;
|
|
257
|
+
followUps(topicId: string, userId: string): Promise<RuntimeGatewayFollowUpLine>;
|
|
258
|
+
editFollowUp(topicId: string, followUpId: string, actor: RuntimeGatewayFollowUpActor, text: string): Promise<RuntimeGatewayFollowUpLine>;
|
|
259
|
+
deleteFollowUp(topicId: string, followUpId: string, actor: RuntimeGatewayFollowUpActor): Promise<RuntimeGatewayFollowUpLine>;
|
|
260
|
+
moveFollowUp(topicId: string, followUpId: string, actor: RuntimeGatewayFollowUpActor, toIndex: number): Promise<RuntimeGatewayFollowUpLine>;
|
|
261
|
+
/** 지금 보내기: into the running turn when it can take it, else as a turn of its own. */
|
|
262
|
+
sendFollowUpNow(topicId: string, followUpId: string, actor: RuntimeGatewayFollowUpActor): Promise<RuntimeGatewayFollowUpLine & {
|
|
263
|
+
sent: boolean;
|
|
264
|
+
}>;
|
|
265
|
+
private changeFollowUp;
|
|
266
|
+
private followUpLineFrom;
|
|
209
267
|
deriveTopic(topicId: string, input: RuntimeGatewayTopicDeriveInput): Promise<RuntimeGatewayDerivedTopic>;
|
|
210
268
|
ensureManagerTopic(userId: string): Promise<RuntimeGatewayManagerTopic>;
|
|
211
269
|
deleteMessage(topicId: string, messageId: string, actorUserId: string, allowAdmin?: boolean): Promise<RuntimeGatewayDeletedMessage>;
|
|
@@ -36,6 +36,18 @@ export interface RuntimeUserTurnExecution {
|
|
|
36
36
|
providerSessionId?: string;
|
|
37
37
|
/** Request ids whose ordered messages were folded into this replacement. */
|
|
38
38
|
supersededRequestIds?: string[];
|
|
39
|
+
/**
|
|
40
|
+
* The message was also delivered into a running turn mid-way. Such a row is
|
|
41
|
+
* never folded into another: when that turn reads the message, exactly this
|
|
42
|
+
* row is dropped, and a batch holding it would answer it a second time.
|
|
43
|
+
*/
|
|
44
|
+
deliveredMidTurn?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* A held follow-up that went out (`runtime-follow-ups`): it is answered as a
|
|
47
|
+
* turn of its own, one per turn, so it is never folded into another request
|
|
48
|
+
* and never absorbs a later one.
|
|
49
|
+
*/
|
|
50
|
+
ownTurn?: boolean;
|
|
39
51
|
/**
|
|
40
52
|
* Slack-style thread this turn belongs to, when it was asked in one. Carried
|
|
41
53
|
* on the request rather than the message because it decides both where the
|
|
@@ -96,6 +108,12 @@ export declare function mergeRuntimeUserTurnRequest(input: {
|
|
|
96
108
|
* worker is running instead of steering (aborting and replacing) it.
|
|
97
109
|
*/
|
|
98
110
|
keepRequestIds?: string[];
|
|
111
|
+
/**
|
|
112
|
+
* Fold rows whose message was delivered into the running turn as well. Only
|
|
113
|
+
* an explicit steer does: the running turn is stopped, so whatever it was
|
|
114
|
+
* handed must ride the turn that replaces it.
|
|
115
|
+
*/
|
|
116
|
+
includeDeliveredMidTurn?: boolean;
|
|
99
117
|
}): {
|
|
100
118
|
requestId: string;
|
|
101
119
|
supersededRequestIds: string[];
|
|
@@ -116,6 +134,13 @@ export declare function claimNextRuntimeUserTurnRequest(ownerId: string, now?: n
|
|
|
116
134
|
export declare function markRuntimeUserTurnRunning(topicId: string, requestId: string, ownerId: string, queryId: string): boolean;
|
|
117
135
|
export declare function releaseRuntimeUserTurnClaim(topicId: string, requestId: string, ownerId: string): boolean;
|
|
118
136
|
export declare function completeRuntimeUserTurnRequest(topicId: string, requestId: string, ownerId: string): boolean;
|
|
137
|
+
/**
|
|
138
|
+
* Drop a queued request the running turn already read: its message was
|
|
139
|
+
* delivered into that turn mid-way (Codex-style steer), so it must not run
|
|
140
|
+
* again as a turn of its own. Only a still-pending row goes; a claimed one is
|
|
141
|
+
* already some worker's turn.
|
|
142
|
+
*/
|
|
143
|
+
export declare function dropReadMidTurnRequest(topicId: string, requestId: string): boolean;
|
|
119
144
|
/** Cancel work captured before a reset/delete epoch began. */
|
|
120
145
|
export declare function cancelRuntimeUserTurnRequestsBeforeEpoch(topicId: string, epoch: number): string[];
|
|
121
146
|
export declare function cancelRuntimeUserTurnRequests(topicId: string): string[];
|
|
@@ -427,6 +427,11 @@ export type WsServerMessage = {
|
|
|
427
427
|
queryId: string;
|
|
428
428
|
topicId: string;
|
|
429
429
|
reason?: "superseded" | "stopped";
|
|
430
|
+
} | {
|
|
431
|
+
type: "messages_read";
|
|
432
|
+
queryId: string;
|
|
433
|
+
topicId: string;
|
|
434
|
+
messageIds: string[];
|
|
430
435
|
} | {
|
|
431
436
|
type: "tool_call";
|
|
432
437
|
queryId: string;
|
|
@@ -223,9 +223,30 @@ export interface RemoteSessionGrant {
|
|
|
223
223
|
hubUrl: string;
|
|
224
224
|
capability: string;
|
|
225
225
|
}
|
|
226
|
+
/** A message a person sent while a turn runs, for that turn to read at its next step. */
|
|
227
|
+
export interface MidTurnMessage {
|
|
228
|
+
/** Canonical message id. The provider names it back once the turn has read it. */
|
|
229
|
+
id: string;
|
|
230
|
+
/** The rendered prompt, as the turn's own first message is rendered. */
|
|
231
|
+
text: string;
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* How a running turn takes messages sent while it works (Codex-style steer: the
|
|
235
|
+
* work goes on, and the agent reads the message after the step it is on).
|
|
236
|
+
* Only a provider that can feed a live turn opens it; for any other the
|
|
237
|
+
* message stays queued for the next turn.
|
|
238
|
+
*/
|
|
239
|
+
export interface MidTurnInput {
|
|
240
|
+
/** The turn can take messages from now on. `deliver` returns false once it no longer can. */
|
|
241
|
+
open(deliver: (message: MidTurnMessage) => boolean): void;
|
|
242
|
+
/** The turn ended. `read` are the delivered ids it read inside the turn; the rest were not read. */
|
|
243
|
+
close(read: readonly string[]): void;
|
|
244
|
+
}
|
|
226
245
|
export interface AgentQueryOptions {
|
|
227
246
|
agent: AgentKind;
|
|
228
247
|
prompt: string;
|
|
248
|
+
/** Present on a person's turn: messages they send while it runs are read inside it. */
|
|
249
|
+
midTurn?: MidTurnInput;
|
|
229
250
|
attachments?: AgentInputAttachment[];
|
|
230
251
|
sessionId?: string | null;
|
|
231
252
|
cwd: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const NEGOTIUM_VERSION = "0.23.
|
|
1
|
+
export declare const NEGOTIUM_VERSION = "0.23.14";
|
package/dist/vault.js
CHANGED
|
@@ -1,27 +1,53 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var __require = import.meta.require;
|
|
3
|
-
|
|
4
2
|
// ../../packages/core/src/storage/vault.ts
|
|
5
3
|
import { chmodSync as chmodSync2, mkdirSync as mkdirSync3 } from "fs";
|
|
6
|
-
import { join as
|
|
4
|
+
import { join as join4 } from "path";
|
|
7
5
|
|
|
8
6
|
// ../../packages/core/src/platform/config.ts
|
|
9
7
|
import { execFileSync } from "child_process";
|
|
10
8
|
import { randomBytes } from "crypto";
|
|
11
9
|
import {
|
|
12
|
-
accessSync,
|
|
10
|
+
accessSync as accessSync2,
|
|
13
11
|
chmodSync,
|
|
14
|
-
constants,
|
|
12
|
+
constants as constants2,
|
|
15
13
|
existsSync,
|
|
16
14
|
mkdirSync,
|
|
17
15
|
readFileSync,
|
|
18
16
|
writeFileSync
|
|
19
17
|
} from "fs";
|
|
20
18
|
import { createRequire } from "module";
|
|
21
|
-
import { homedir } from "os";
|
|
22
|
-
import { dirname, join, resolve } from "path";
|
|
19
|
+
import { homedir as homedir2 } from "os";
|
|
20
|
+
import { dirname, join as join2, resolve } from "path";
|
|
23
21
|
import { fileURLToPath, pathToFileURL } from "url";
|
|
24
22
|
|
|
23
|
+
// ../../packages/core/src/platform/browser-backend.ts
|
|
24
|
+
import { accessSync, constants, statSync } from "fs";
|
|
25
|
+
import { homedir } from "os";
|
|
26
|
+
import { delimiter, isAbsolute, join } from "path";
|
|
27
|
+
function resolveBrowserBackend(value, findEgoBrowser = resolveEgoBrowserBin) {
|
|
28
|
+
const backend = value?.trim();
|
|
29
|
+
if (!backend)
|
|
30
|
+
return findEgoBrowser() ? "egolite" : "chrome";
|
|
31
|
+
if (backend === "chrome" || backend === "egolite")
|
|
32
|
+
return backend;
|
|
33
|
+
throw new Error("NEGOTIUM_BROWSER_BACKEND must be chrome or egolite");
|
|
34
|
+
}
|
|
35
|
+
function resolveEgoBrowserBin(path = process.env.PATH ?? "", home = homedir()) {
|
|
36
|
+
const names = process.platform === "win32" ? ["ego-browser.exe"] : ["ego-browser"];
|
|
37
|
+
const directories = [...path.split(delimiter).filter(isAbsolute), join(home, ".local", "bin")];
|
|
38
|
+
for (const directory of directories) {
|
|
39
|
+
for (const name of names) {
|
|
40
|
+
const candidate = join(directory, name);
|
|
41
|
+
try {
|
|
42
|
+
accessSync(candidate, constants.X_OK);
|
|
43
|
+
if (statSync(candidate).isFile())
|
|
44
|
+
return candidate;
|
|
45
|
+
} catch {}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
|
|
25
51
|
// ../../packages/core/src/types.ts
|
|
26
52
|
var SUPPORTED_AGENTS = ["maestro", "claude", "codex"];
|
|
27
53
|
function isAgentKind(value) {
|
|
@@ -73,7 +99,7 @@ var logger = createStdioLogger();
|
|
|
73
99
|
function envText(envKey) {
|
|
74
100
|
return readEnvText(process.env, envKey);
|
|
75
101
|
}
|
|
76
|
-
var HOME =
|
|
102
|
+
var HOME = homedir2();
|
|
77
103
|
function resolveStateDir() {
|
|
78
104
|
const configured = envText("NEGOTIUM_STATE_DIR");
|
|
79
105
|
if (false) {}
|
|
@@ -122,6 +148,7 @@ var TOPIC_WORKSPACE_DIR = resolve(WORKSPACE_DIR, "topics");
|
|
|
122
148
|
var SHARED_WIKI_DIR = resolve(WORKSPACE_DIR, "wiki");
|
|
123
149
|
var CRON_WORKSPACE_DIR = resolve(WORKSPACE_DIR, "cron");
|
|
124
150
|
var BROWSER_DIR = resolveLocalStateDir("NEGOTIUM_BROWSER_DIR", "browser");
|
|
151
|
+
var BROWSER_BACKEND = resolveBrowserBackend(envText("NEGOTIUM_BROWSER_BACKEND"));
|
|
125
152
|
var BROWSER_PROFILES_DIR = resolve(BROWSER_DIR, "profiles");
|
|
126
153
|
var BINARIES_DIR = resolve(STATE_DIR, "binaries");
|
|
127
154
|
var SECRETS_DIR = resolve(STATE_DIR, "secrets");
|
|
@@ -169,7 +196,7 @@ function resolveBrowserRsBin(envValue) {
|
|
|
169
196
|
}
|
|
170
197
|
const candidate = override ? resolve(override) : resolve(BINARIES_DIR, "browser-rs", BROWSER_RS_VERSION, `browser-rs${BINARY_EXTENSION}`);
|
|
171
198
|
try {
|
|
172
|
-
|
|
199
|
+
accessSync2(candidate, constants2.X_OK);
|
|
173
200
|
return browserRsMeetsMinimumVersion(candidate) ? candidate : undefined;
|
|
174
201
|
} catch {
|
|
175
202
|
return;
|
|
@@ -182,7 +209,7 @@ function resolveBashRsBin(envValue) {
|
|
|
182
209
|
const override = envValue?.trim();
|
|
183
210
|
const candidate = override ? resolve(override) : resolve(BINARIES_DIR, "bash-rs", BASH_RS_VERSION, `bash-rs${BINARY_EXTENSION}`);
|
|
184
211
|
try {
|
|
185
|
-
|
|
212
|
+
accessSync2(candidate, constants2.X_OK);
|
|
186
213
|
return candidate;
|
|
187
214
|
} catch {
|
|
188
215
|
return;
|
|
@@ -382,8 +409,8 @@ function closeDatabase(database) {
|
|
|
382
409
|
|
|
383
410
|
// ../../packages/core/src/storage/storage-host.ts
|
|
384
411
|
import { mkdirSync as mkdirSync2 } from "fs";
|
|
385
|
-
import { homedir as
|
|
386
|
-
import { dirname as dirname2, join as
|
|
412
|
+
import { homedir as homedir3 } from "os";
|
|
413
|
+
import { dirname as dirname2, join as join3, resolve as resolve2 } from "path";
|
|
387
414
|
var STORAGE_HOST_STATE = Symbol.for("negotium.storage-host.state.v1");
|
|
388
415
|
function storageState() {
|
|
389
416
|
const holder = globalThis;
|
|
@@ -412,13 +439,13 @@ function envPath(name, fallback) {
|
|
|
412
439
|
return resolve2(value || fallback);
|
|
413
440
|
}
|
|
414
441
|
function defaultStateDir() {
|
|
415
|
-
return envPath("NEGOTIUM_STATE_DIR",
|
|
442
|
+
return envPath("NEGOTIUM_STATE_DIR", join3(homedir3(), ".negotium"));
|
|
416
443
|
}
|
|
417
444
|
function defaultDataDir() {
|
|
418
|
-
return envPath("NEGOTIUM_DATA_DIR",
|
|
445
|
+
return envPath("NEGOTIUM_DATA_DIR", join3(defaultStateDir(), "data"));
|
|
419
446
|
}
|
|
420
447
|
function defaultSessionsDatabasePath() {
|
|
421
|
-
return envPath("SESSIONS_DB_PATH",
|
|
448
|
+
return envPath("SESSIONS_DB_PATH", join3(resolveStorageDataDir(), "sessions.db"));
|
|
422
449
|
}
|
|
423
450
|
var SQLITE_INIT_RETRY_MS = 25;
|
|
424
451
|
var SQLITE_INIT_TIMEOUT_MS = 5000;
|
|
@@ -597,8 +624,8 @@ function initializeVaultDatabase(database) {
|
|
|
597
624
|
}
|
|
598
625
|
}
|
|
599
626
|
function openVaultDatabase(dataDir) {
|
|
600
|
-
const vaultDir =
|
|
601
|
-
const path =
|
|
627
|
+
const vaultDir = join4(dataDir, "vault");
|
|
628
|
+
const path = join4(vaultDir, "vault.db");
|
|
602
629
|
mkdirSync3(vaultDir, { recursive: true, mode: 448 });
|
|
603
630
|
const database = new Database(path, { create: true });
|
|
604
631
|
chmodSync2(path, 384);
|
|
@@ -825,26 +852,26 @@ function redactVaultSecrets(userId, text) {
|
|
|
825
852
|
return redacted;
|
|
826
853
|
}
|
|
827
854
|
export {
|
|
828
|
-
|
|
829
|
-
vaultSet,
|
|
830
|
-
vaultListWithValues,
|
|
831
|
-
vaultList,
|
|
832
|
-
vaultHasKey,
|
|
833
|
-
vaultGetValue,
|
|
834
|
-
vaultDeleteAllForUser,
|
|
835
|
-
vaultDel,
|
|
836
|
-
valueReferencesVaultKey,
|
|
837
|
-
validateVaultKey,
|
|
838
|
-
redactVaultSecrets,
|
|
839
|
-
normalizeVaultKey,
|
|
840
|
-
isEncryptedVaultValue,
|
|
841
|
-
encryptVaultValue,
|
|
842
|
-
decryptVaultValue,
|
|
843
|
-
configureVaultStorage,
|
|
844
|
-
VAULT_VALUE_MIN_BYTES,
|
|
845
|
-
VAULT_VALUE_MAX_BYTES,
|
|
855
|
+
VAULT_DESCRIPTION_MAX_LENGTH,
|
|
846
856
|
VAULT_KEY_PATTERN,
|
|
847
|
-
|
|
857
|
+
VAULT_VALUE_MAX_BYTES,
|
|
858
|
+
VAULT_VALUE_MIN_BYTES,
|
|
859
|
+
configureVaultStorage,
|
|
860
|
+
decryptVaultValue,
|
|
861
|
+
encryptVaultValue,
|
|
862
|
+
isEncryptedVaultValue,
|
|
863
|
+
normalizeVaultKey,
|
|
864
|
+
redactVaultSecrets,
|
|
865
|
+
validateVaultKey,
|
|
866
|
+
valueReferencesVaultKey,
|
|
867
|
+
vaultDel,
|
|
868
|
+
vaultDeleteAllForUser,
|
|
869
|
+
vaultGetValue,
|
|
870
|
+
vaultHasKey,
|
|
871
|
+
vaultList,
|
|
872
|
+
vaultListWithValues,
|
|
873
|
+
vaultSet,
|
|
874
|
+
vaultSubstituteDetailed
|
|
848
875
|
};
|
|
849
876
|
|
|
850
|
-
//# debugId=
|
|
877
|
+
//# debugId=BB81D524A99220BD64756E2164756E21
|