negotium 0.23.7 → 0.23.8

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.
Files changed (36) hide show
  1. package/dist/agent-helpers.js +87 -18
  2. package/dist/agent-helpers.js.map +9 -9
  3. package/dist/{chunk-ejvh95f5.js → chunk-g5etvfj3.js} +2 -2
  4. package/dist/{chunk-ejvh95f5.js.map → chunk-g5etvfj3.js.map} +2 -2
  5. package/dist/hosted-agent.js +2 -2
  6. package/dist/hosted-agent.js.map +2 -2
  7. package/dist/main.js +396 -111
  8. package/dist/main.js.map +21 -21
  9. package/dist/mcp-factories.js +87 -18
  10. package/dist/mcp-factories.js.map +9 -9
  11. package/dist/prompts.js +3 -1
  12. package/dist/prompts.js.map +3 -3
  13. package/dist/registry.js +1 -1
  14. package/dist/runtime/src/agents/mcp-tools/ask-user.ts +56 -12
  15. package/dist/runtime/src/agents/mcp-tools/request-vault.ts +73 -5
  16. package/dist/runtime/src/application/submit-runtime-gateway-turn.ts +7 -0
  17. package/dist/runtime/src/application/topic-service.ts +31 -5
  18. package/dist/runtime/src/index.ts +1 -0
  19. package/dist/runtime/src/mcp-runtime-host.ts +4 -1
  20. package/dist/runtime/src/prompts/builders.ts +2 -0
  21. package/dist/runtime/src/prompts/sessions/channel-system.md +1 -0
  22. package/dist/runtime/src/prompts/sessions/topic-system.md +1 -0
  23. package/dist/runtime/src/runtime-gateway.ts +5 -0
  24. package/dist/runtime/src/storage/ask-user-gates.ts +3 -1
  25. package/dist/runtime/src/storage/runtime-turn-requests.ts +42 -1
  26. package/dist/runtime/src/version.ts +1 -1
  27. package/dist/runtime-gateway.js.map +2 -2
  28. package/dist/storage.js +2 -2
  29. package/dist/storage.js.map +3 -3
  30. package/dist/types/packages/core/src/agents/mcp-tools/ask-user.d.ts +10 -2
  31. package/dist/types/packages/core/src/agents/mcp-tools/request-vault.d.ts +4 -0
  32. package/dist/types/packages/core/src/runtime-gateway.d.ts +5 -0
  33. package/dist/types/packages/core/src/storage/ask-user-gates.d.ts +2 -0
  34. package/dist/types/packages/core/src/storage/runtime-turn-requests.d.ts +15 -0
  35. package/dist/types/packages/core/src/version.d.ts +1 -1
  36. package/package.json +1 -1
@@ -7,6 +7,13 @@ export type AskUserChoice = {
7
7
  label: string;
8
8
  description?: string;
9
9
  };
10
+ /** The label recorded on a card the user skipped instead of answering. */
11
+ export declare const SKIP_ANSWER_LABEL = "Skipped";
12
+ /** How the user answered: a listed choice (default), their own words, or a skip. */
13
+ export type AskUserAnswerKind = "custom" | "skip";
14
+ export interface AnswerAskUserQuestionOptions {
15
+ kind?: AskUserAnswerKind;
16
+ }
10
17
  export interface AskUserToolContext {
11
18
  userId: string;
12
19
  topicId: string;
@@ -64,6 +71,7 @@ export interface AskUserRuntimeHost {
64
71
  topicId: string;
65
72
  messageId: string;
66
73
  label: string;
74
+ allowAnyLabel?: boolean;
67
75
  userId: string;
68
76
  ownerId: string;
69
77
  source: string;
@@ -91,7 +99,7 @@ export interface AskUserRuntime {
91
99
  stopGateOwner(): void;
92
100
  reconcilePendingGates(): number;
93
101
  hasPendingQuestion(topicId: string, messageId: string): boolean;
94
- answerPendingQuestion(topicId: string, messageId: string, label: string, userId: string): AnswerAskUserQuestionResult;
102
+ answerPendingQuestion(topicId: string, messageId: string, label: string, userId: string, options?: AnswerAskUserQuestionOptions): AnswerAskUserQuestionResult;
95
103
  cancelPendingQuestions(topicId: string, queryId: string): void;
96
104
  createToolDefinition(ctx: AskUserToolContext): SharedMcpTool;
97
105
  }
@@ -134,6 +142,6 @@ export declare function hasPendingAskUserQuestion(topicId: string, messageId: st
134
142
  * persistence ordering. A successful call resumes the blocked MCP tool in the
135
143
  * same provider turn.
136
144
  */
137
- export declare function answerPendingAskUserQuestion(topicId: string, messageId: string, label: string, userId: string): AnswerAskUserQuestionResult;
145
+ export declare function answerPendingAskUserQuestion(topicId: string, messageId: string, label: string, userId: string, options?: AnswerAskUserQuestionOptions): AnswerAskUserQuestionResult;
138
146
  export declare function cancelPendingAskUserQuestions(topicId: string, queryId: string): void;
139
147
  export declare function createAskUserToolDefinition(ctx: AskUserToolContext): SharedMcpTool;
@@ -50,6 +50,8 @@ export interface RequestVaultRuntimeHost {
50
50
  /** Writes the secret. Called before the gate is claimed, so a storage
51
51
  * failure never leaves a card marked "fulfilled" without a stored value. */
52
52
  set(userId: string, key: string, value: string, description: string): void;
53
+ /** Removes a key outright. Returns false when there was nothing to delete. */
54
+ del(userId: string, key: string): boolean;
53
55
  };
54
56
  durability: {
55
57
  gates: {
@@ -96,6 +98,7 @@ export interface RequestVaultRuntime {
96
98
  answerPendingRequest(topicId: string, messageId: string, userId: string, value: string | null): AnswerVaultSecretRequestResult;
97
99
  cancelPendingRequests(topicId: string, queryId: string): void;
98
100
  createToolDefinition(ctx: RequestVaultToolContext): SharedMcpTool;
101
+ createDeleteToolDefinition(ctx: RequestVaultToolContext): SharedMcpTool;
99
102
  }
100
103
  /**
101
104
  * Create an isolated request-vault-secret lifecycle over host-provided
@@ -118,3 +121,4 @@ export declare function reconcilePendingRequestVaultGates(): number;
118
121
  export declare function answerPendingVaultSecretRequest(topicId: string, messageId: string, userId: string, value: string | null): AnswerVaultSecretRequestResult;
119
122
  export declare function cancelPendingVaultSecretRequests(topicId: string, queryId: string): void;
120
123
  export declare function createRequestVaultToolDefinition(ctx: RequestVaultToolContext): SharedMcpTool;
124
+ export declare function createDeleteVaultToolDefinition(ctx: RequestVaultToolContext): SharedMcpTool;
@@ -62,6 +62,11 @@ export interface RuntimeGatewayTurnInput {
62
62
  /** Inline quote-reply target. Mutually exclusive with `threadRootId`. */
63
63
  parentId?: string;
64
64
  respond?: boolean;
65
+ /**
66
+ * While a turn from the same person runs: `true` (default) aborts it and
67
+ * resumes with the merged batch; `false` queues this message behind it.
68
+ */
69
+ steer?: boolean;
65
70
  /** Run without adding the injected prompt or output to the visible transcript. */
66
71
  silent?: boolean;
67
72
  attachments?: string[];
@@ -55,6 +55,8 @@ export declare function claimAskUserGateAndSelect(args: {
55
55
  topicId: string;
56
56
  messageId: string;
57
57
  label: string;
58
+ /** Accept a label that is not one of the card's choices (free-text answer or skip). */
59
+ allowAnyLabel?: boolean;
58
60
  userId: string;
59
61
  ownerId: string;
60
62
  source: string;
@@ -90,6 +90,12 @@ export declare function mergeRuntimeUserTurnRequest(input: {
90
90
  alreadyIncludedRequestIds?: string[];
91
91
  /** Requests already committed to the provider's native session; keep their lineage, not prompts. */
92
92
  omitRequestIds?: string[];
93
+ /**
94
+ * Requests that must stay standing and never be folded into this one, even
95
+ * for the same actor and thread. Used to queue a message behind the turn a
96
+ * worker is running instead of steering (aborting and replacing) it.
97
+ */
98
+ keepRequestIds?: string[];
93
99
  }): {
94
100
  requestId: string;
95
101
  supersededRequestIds: string[];
@@ -120,4 +126,13 @@ export declare function cancelRuntimeUserTurnRequests(topicId: string): string[]
120
126
  * `submitRuntimeGatewayTurn`).
121
127
  */
122
128
  export declare function getActiveRuntimeUserTurnRequest(topicId: string): RuntimeUserTurnRequest | null;
129
+ /**
130
+ * Fold the messages queued behind a running turn into it, so a steer can run
131
+ * them now. Same replacement `mergeRuntimeUserTurnRequest` makes for a steering
132
+ * message, but with no new message: the running request and the queued tail it
133
+ * shares an actor and thread with become one pending batch. Returns the
134
+ * absorbed running request's id, or null when there is nothing to fold (no
135
+ * running turn, nothing queued, or the queue belongs to someone else).
136
+ */
137
+ export declare function foldQueuedIntoActiveRuntimeUserTurnRequest(topicId: string, newRequestId: string): string | null;
123
138
  export declare function getRuntimeUserTurnRequest(topicId: string): RuntimeUserTurnRequest | null;
@@ -1 +1 @@
1
- export declare const NEGOTIUM_VERSION = "0.23.7";
1
+ export declare const NEGOTIUM_VERSION = "0.23.8";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "negotium",
3
- "version": "0.23.7",
3
+ "version": "0.23.8",
4
4
  "type": "module",
5
5
  "description": "Install the Negotium multi-agent runtime and CLI with one package",
6
6
  "license": "Apache-2.0",