@tangle-network/agent-app 4.0.9 → 4.0.12
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/billing/identity-bound.d.ts +8 -1
- package/dist/billing/index.d.ts +1 -1
- package/dist/billing/index.js +3 -1
- package/dist/chat-routes/failure-wording.d.ts +38 -33
- package/dist/chat-routes/index.js +20 -20
- package/dist/chat-routes/index.js.map +1 -1
- package/dist/{chunk-R5PW3FO4.js → chunk-2IGXFHUO.js} +13 -2
- package/dist/chunk-2IGXFHUO.js.map +1 -0
- package/dist/{chunk-XZ37VCTP.js → chunk-CD4SJXYC.js} +92 -797
- package/dist/chunk-CD4SJXYC.js.map +1 -0
- package/dist/{chunk-AYTNVTDP.js → chunk-QMQB725F.js} +3 -13
- package/dist/chunk-QMQB725F.js.map +1 -0
- package/dist/chunk-RNDWCT4O.js +1136 -0
- package/dist/chunk-RNDWCT4O.js.map +1 -0
- package/dist/{chunk-W2DIPVHW.js → chunk-TMWUWKLU.js} +6 -5
- package/dist/chunk-TMWUWKLU.js.map +1 -0
- package/dist/{chunk-FTGKXM7O.js → chunk-Z5KJ7WM3.js} +15 -6
- package/dist/chunk-Z5KJ7WM3.js.map +1 -0
- package/dist/preset-cloudflare/index.js +7 -4
- package/dist/preset-cloudflare/index.js.map +1 -1
- package/dist/public-consultation/index.js +5 -5
- package/dist/sandbox/index.js +3 -3
- package/package.json +1 -1
- package/dist/chunk-AYTNVTDP.js.map +0 -1
- package/dist/chunk-FTGKXM7O.js.map +0 -1
- package/dist/chunk-K4YIDNX5.js +0 -263
- package/dist/chunk-K4YIDNX5.js.map +0 -1
- package/dist/chunk-R5PW3FO4.js.map +0 -1
- package/dist/chunk-W2DIPVHW.js.map +0 -1
- package/dist/chunk-XZ37VCTP.js.map +0 -1
|
@@ -201,6 +201,11 @@ export interface DurableWorkspaceKeyManagerOptions {
|
|
|
201
201
|
now?: () => Date;
|
|
202
202
|
/** Local lifetime used when the remote response omits an expiry. */
|
|
203
203
|
keyLifetimeMs?: number;
|
|
204
|
+
/**
|
|
205
|
+
* Least remaining life a reused key needs: the app's longest turn plus a margin, shorter than `keyLifetimeMs`. Below
|
|
206
|
+
* it a fresh key is minted and the old one retired at its own expiry, never revoked under a turn that holds it.
|
|
207
|
+
*/
|
|
208
|
+
minRemainingLifetimeMs?: number;
|
|
204
209
|
/** Lease lifetime for remote operations. */
|
|
205
210
|
leaseMs?: number;
|
|
206
211
|
/** Maximum time to wait for another issuer to release the scope lease. */
|
|
@@ -213,13 +218,15 @@ export interface DurableWorkspaceKeyManagerOptions {
|
|
|
213
218
|
revocationRetryBaseMs?: number;
|
|
214
219
|
/** Maximum delay for a failed remote revoke. */
|
|
215
220
|
revocationRetryMaxMs?: number;
|
|
216
|
-
/**
|
|
221
|
+
/** Remote name; the mint's operation id is appended when absent, as a create under a held name revokes its key. */
|
|
217
222
|
nameForIdentity?: (identity: WorkspaceKeyIdentity, operationId: string) => string;
|
|
218
223
|
/** Resolve names for rows written before `name` became durable. Null blocks issuance safely. */
|
|
219
224
|
legacyNameForRecord?: (record: DurableWorkspaceKeyRecord) => string | null | undefined;
|
|
220
225
|
/** Recognize a missing remote key without depending on a provider SDK. */
|
|
221
226
|
isRemoteMissing?: (error: unknown) => boolean;
|
|
222
227
|
}
|
|
228
|
+
/** Default reuse floor: a 15 min turn plus a 5 min margin; this package sets no turn limit, so longer turns pass their own. */
|
|
229
|
+
export declare const DEFAULT_MIN_REMAINING_KEY_LIFETIME_MS: number;
|
|
223
230
|
/**
|
|
224
231
|
* Create a product-neutral manager for child-key issuance and cleanup.
|
|
225
232
|
*
|
package/dist/billing/index.d.ts
CHANGED
|
@@ -256,4 +256,4 @@ export interface PlatformBalanceManager<Plan extends string> {
|
|
|
256
256
|
export declare function createPlatformBalanceManager<Plan extends string>(opts: PlatformBalanceManagerOptions<Plan>): PlatformBalanceManager<Plan>;
|
|
257
257
|
/** Create a workspace key manager that handles key provisioning and budget tracking */
|
|
258
258
|
export declare function createWorkspaceKeyManager(opts: WorkspaceKeyManagerOptions): WorkspaceKeyManager;
|
|
259
|
-
export { createIdentityBoundWorkspaceKeyManager, type DurableWorkspaceKeyManager, type DurableWorkspaceKeyManagerOptions, type DurableWorkspaceKeyCreateInput, type DurableWorkspaceKeyConditionalWrites, type DurableWorkspaceKeyProvisioner, type DurableWorkspaceKeyProvisioningRecord, type DurableWorkspaceKeyRecord, type DurableWorkspaceKeyScope, type DurableWorkspaceKeyStore, type WorkspaceKeyIdentity, type WorkspaceKeyProduct, type WorkspaceKeyStatus, type WorkspaceKeyUsage, type WorkspaceRuntimeKey, } from './identity-bound.js';
|
|
259
|
+
export { createIdentityBoundWorkspaceKeyManager, DEFAULT_MIN_REMAINING_KEY_LIFETIME_MS, type DurableWorkspaceKeyManager, type DurableWorkspaceKeyManagerOptions, type DurableWorkspaceKeyCreateInput, type DurableWorkspaceKeyConditionalWrites, type DurableWorkspaceKeyProvisioner, type DurableWorkspaceKeyProvisioningRecord, type DurableWorkspaceKeyRecord, type DurableWorkspaceKeyScope, type DurableWorkspaceKeyStore, type WorkspaceKeyIdentity, type WorkspaceKeyProduct, type WorkspaceKeyStatus, type WorkspaceKeyUsage, type WorkspaceRuntimeKey, } from './identity-bound.js';
|
package/dist/billing/index.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
|
+
DEFAULT_MIN_REMAINING_KEY_LIFETIME_MS,
|
|
2
3
|
createIdentityBoundWorkspaceKeyManager,
|
|
3
4
|
createPlatformBalanceManager,
|
|
4
5
|
createTcloudKeyProvisioner,
|
|
5
6
|
createWorkspaceKeyManager,
|
|
6
7
|
readSharedBillingState
|
|
7
|
-
} from "../chunk-
|
|
8
|
+
} from "../chunk-Z5KJ7WM3.js";
|
|
8
9
|
import "../chunk-VGS2NXLB.js";
|
|
9
10
|
export {
|
|
11
|
+
DEFAULT_MIN_REMAINING_KEY_LIFETIME_MS,
|
|
10
12
|
createIdentityBoundWorkspaceKeyManager,
|
|
11
13
|
createPlatformBalanceManager,
|
|
12
14
|
createTcloudKeyProvisioner,
|
|
@@ -1,56 +1,61 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* What a person reads when a sandbox turn fails
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
2
|
+
* What a person reads when a sandbox turn fails: only sentences written here. Harness, provider and Router text is read
|
|
3
|
+
* only to classify the failure, by its code, its HTTP status or a recognized phrase, and the person reads that class's
|
|
4
|
+
* fixed sentence. No part of the reason is shown; the only values in a sentence are times parsed and formatted here.
|
|
5
|
+
* The server keeps the reason, in its log and under a Symbol key the route's own failure hooks read. `personFacing`
|
|
6
|
+
* applies this to every event the sandbox producer yields.
|
|
7
7
|
*/
|
|
8
8
|
import { type JsonRecord } from '../stream/index.js';
|
|
9
9
|
type Log = (message: string, meta?: Record<string, unknown>) => void;
|
|
10
|
-
|
|
10
|
+
export declare const FAILED_TURN_TEXT = "That answer stopped before it finished. Please send your question again.";
|
|
11
|
+
/** A harness's provider retry wait (OpenCode's raw `retry` status) as one sentence with its next attempt's time. */
|
|
11
12
|
export declare function providerRetryNotice(event: {
|
|
12
13
|
type: string;
|
|
13
14
|
data?: unknown;
|
|
14
15
|
}): string | undefined;
|
|
15
|
-
/** A terminal provider wait (`…, reset at <ISO>`, agent-container provider-retry-wait.ts) as one sentence. */
|
|
16
|
+
/** A terminal provider wait (`…, reset at <ISO>`, agent-container provider-retry-wait.ts) as one sentence with its time. */
|
|
16
17
|
export declare function providerResetSentence(message: string): string | undefined;
|
|
17
18
|
/** The typed code for a harness whose model refused its key, so a product can tell it from other stream failures. */
|
|
18
19
|
export declare const MODEL_KEY_REFUSED_CODE = "model.key_refused";
|
|
19
20
|
/** A harness whose model provider refused its key ("Invalid API key", OpenCode's `OPENCODE_ERROR`) as plain words, true
|
|
20
21
|
* both for a newly started box whose harness called the model before its minted key was in place (it recovers within
|
|
21
|
-
* minutes) and for a key that is wrong. The raw error goes to the log
|
|
22
|
+
* minutes) and for a key that is wrong. The raw error goes to the log, never to the person. */
|
|
22
23
|
export declare function modelKeyRefusedSentence(message: string): string | undefined;
|
|
23
|
-
/**
|
|
24
|
-
export
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
/** A failure event the person can read (`error`, `warning`, `done`, `session.run.failed`): when a reason field is one the
|
|
29
|
-
* producer words plainly, every reason field carries that sentence and the raw text moves to `details.raw`. The client
|
|
30
|
-
* prints an error event's `message`, and the route's failure card reads `message`/`error`/`reason`. */
|
|
31
|
-
export declare function plainFailureEvent(event: JsonRecord): JsonRecord;
|
|
32
|
-
export declare const FAILED_TURN_TEXT = "That answer stopped before it finished. Please send your question again.";
|
|
33
|
-
/** True when a terminal failure's reason (a harness error, a tool list, a call loop, a stack) is withheld: the person
|
|
34
|
-
* reads the failed-turn text and the server log (`log`, else `console.warn`) keeps the reason under one class, with
|
|
35
|
-
* `meta` (the ids and failure note the producer has). Passing through: a plainly worded reason (a provider reset, a
|
|
36
|
-
* refused model key, a Router budget or balance refusal); HTTP 402; a {@link REFUSAL_CODES} refusal; and what the
|
|
37
|
-
* client's recovery UI reads (`getChatFundingRecovery`: `insufficient_credits`, `paid_access_required`,
|
|
38
|
-
* `funding_required`, or its words). */
|
|
39
|
-
export declare function withheld(log: Log | undefined, reason: string, code: string | undefined, status: unknown, meta?: Record<string, unknown>): boolean;
|
|
24
|
+
/** How a failure reads to the person: its class and that class's fixed sentence. */
|
|
25
|
+
export interface FailureView {
|
|
26
|
+
class: string;
|
|
27
|
+
shown: string;
|
|
28
|
+
}
|
|
40
29
|
/** The turn, thread, session and execution ids a record carries, for the server log. */
|
|
41
30
|
export declare function failureIds(source: unknown): Record<string, string>;
|
|
42
|
-
/**
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
31
|
+
/** The text a failure adds to the answer: its sentence, after a lead line for the classes that carry one. */
|
|
32
|
+
export declare function failureText(view: FailureView, partialAnswer: string): string;
|
|
33
|
+
/** The reason a failure carries, wherever its producer put it: in `data`, a nested error, a session error's
|
|
34
|
+
* properties, the top level, or a raw harness event. Empty when there is none, so a failure always reads its class. */
|
|
35
|
+
export declare function failureReason(event: unknown): string;
|
|
36
|
+
/** One turn's person-facing filter. `view` classifies a failure reason; every reason is logged once, at warn (`log`,
|
|
37
|
+
* else `console.warn`), with its class and ids, and the same reason reads the same wherever it appears. `warning`
|
|
38
|
+
* gives an allowed warning's sentence. `event` is every event the producer yields as it may reach the client.
|
|
39
|
+
* `hasAnswer` says whether the turn already shows answer text. */
|
|
40
|
+
export declare function personFacing(options: {
|
|
41
|
+
log?: Log;
|
|
42
|
+
failedTurnText: string;
|
|
43
|
+
hasAnswer?: () => boolean;
|
|
44
|
+
}): {
|
|
45
|
+
view: (reason: string, code?: string, status?: unknown, meta?: Record<string, unknown>) => FailureView;
|
|
46
|
+
warning: (code: string | undefined, message: string, meta?: Record<string, unknown>) => string | undefined;
|
|
47
|
+
event: (event: JsonRecord) => JsonRecord | undefined;
|
|
48
|
+
};
|
|
49
|
+
/** A thrown sandbox stream as the operator's failure note, its code and its raw reason. */
|
|
47
50
|
export declare function sandboxStreamFailureDiagnostic(error: unknown): {
|
|
48
|
-
userMessage: string;
|
|
49
51
|
failureNote: string;
|
|
50
52
|
code: string;
|
|
51
53
|
reason: string;
|
|
52
54
|
};
|
|
53
|
-
/**
|
|
54
|
-
|
|
55
|
+
/** The typed reason a sandbox `error` event carries, or a generic stream-error code. */
|
|
56
|
+
export declare function sandboxStreamErrorCode(data: unknown): string;
|
|
57
|
+
/** A tool part as the person may read it, live and stored: a failed call's `error` and `output` lose the harness's list
|
|
58
|
+
* of every tool, and the harness's `invalid` repair tool, which stands in for a call to a tool the model does not have,
|
|
59
|
+
* reads one sentence. Inputs, metadata and a completed call's output (a document it read) stay whole. */
|
|
55
60
|
export declare function withoutToolList(part: JsonRecord): JsonRecord;
|
|
56
61
|
export {};
|
|
@@ -40,77 +40,77 @@ import {
|
|
|
40
40
|
observeNativeCompletion,
|
|
41
41
|
readCompletedSandboxTurn,
|
|
42
42
|
recoverSandboxAssistantMessage
|
|
43
|
-
} from "../chunk-
|
|
43
|
+
} from "../chunk-TMWUWKLU.js";
|
|
44
44
|
import {
|
|
45
45
|
runProtectedRouterTurn
|
|
46
46
|
} from "../chunk-GWATTXFR.js";
|
|
47
47
|
import {
|
|
48
|
-
DEFAULT_MODEL_FIRST_RESPONSE_TIMEOUT_MS,
|
|
49
|
-
DEFAULT_MODEL_STREAM_OPEN_TIMEOUT_MS,
|
|
50
48
|
HYBRID_TURN_GUIDANCE,
|
|
51
49
|
INTENT_LINE_HISTORY_MESSAGES,
|
|
52
50
|
INTENT_LINE_MAX_CHARS,
|
|
53
51
|
INTENT_LINE_TIMEOUT_MS,
|
|
54
|
-
MAX_EMPTY_TURN_RETRIES,
|
|
55
|
-
MODEL_KEY_REFUSED_CODE,
|
|
56
|
-
ModelFailoverTimeoutError,
|
|
57
52
|
SPEAKER_EVENT,
|
|
58
53
|
UPLOAD_INLINE_MAX_BYTES,
|
|
59
54
|
UPLOAD_MAX_FILE_BYTES,
|
|
60
55
|
buildDispatchParts,
|
|
61
56
|
bytesToBase64,
|
|
62
57
|
cancelChatTurn,
|
|
63
|
-
classifyTerminalFailure,
|
|
64
58
|
composeAgentProducers,
|
|
65
59
|
createChatTurnRoutes,
|
|
66
60
|
createHybridTurnProducer,
|
|
67
61
|
createRouterTurnProducer,
|
|
68
62
|
createSandboxChatProducer,
|
|
69
63
|
createUploadRoute,
|
|
70
|
-
isCommittingSandboxEvent,
|
|
71
|
-
isLiveLifecycleEvent,
|
|
72
|
-
modelKeyRefusedSentence,
|
|
73
64
|
normalizeChatPromptForSandbox,
|
|
74
65
|
observeTurnCancellation,
|
|
75
66
|
projectDispatchHistory,
|
|
76
|
-
providerResetSentence,
|
|
77
|
-
providerRetryNotice,
|
|
78
67
|
redactEvents,
|
|
79
|
-
resolveEmptyTurnRetries,
|
|
80
68
|
routerTurnHistory,
|
|
81
69
|
sanitizeUploadFilename,
|
|
82
70
|
speakerPart,
|
|
83
71
|
startHybridBox,
|
|
84
72
|
streamChatRouteAsSandboxEvents,
|
|
85
|
-
streamWithModelFailover,
|
|
86
|
-
summarizeFailoverReason,
|
|
87
73
|
turnCarriesFiles,
|
|
88
74
|
turnPromptText,
|
|
89
75
|
valueRedactor,
|
|
90
76
|
withProducerStream
|
|
91
|
-
} from "../chunk-
|
|
92
|
-
import "../chunk-QUV5M7SZ.js";
|
|
77
|
+
} from "../chunk-CD4SJXYC.js";
|
|
93
78
|
import "../chunk-SBHFMDR7.js";
|
|
94
79
|
import "../chunk-H6BRJU5M.js";
|
|
95
80
|
import "../chunk-4DBHC63F.js";
|
|
96
81
|
import "../chunk-RN4WPTBH.js";
|
|
97
82
|
import "../chunk-MM6RLOXF.js";
|
|
98
83
|
import "../chunk-M4QITAQV.js";
|
|
99
|
-
import "../chunk-
|
|
84
|
+
import "../chunk-QMQB725F.js";
|
|
100
85
|
import "../chunk-F4TUZYMX.js";
|
|
101
86
|
import {
|
|
102
87
|
redactErrorMessage
|
|
103
88
|
} from "../chunk-MH74DY2I.js";
|
|
104
89
|
import {
|
|
90
|
+
DEFAULT_MODEL_FIRST_RESPONSE_TIMEOUT_MS,
|
|
91
|
+
DEFAULT_MODEL_STREAM_OPEN_TIMEOUT_MS,
|
|
92
|
+
MAX_EMPTY_TURN_RETRIES,
|
|
93
|
+
MODEL_KEY_REFUSED_CODE,
|
|
94
|
+
ModelFailoverTimeoutError,
|
|
105
95
|
TURN_USAGE_KEYS,
|
|
106
96
|
assistantRowIdForTurn,
|
|
97
|
+
classifyTerminalFailure,
|
|
107
98
|
createAssistantDraftWriter,
|
|
99
|
+
isCommittingSandboxEvent,
|
|
108
100
|
isDraftContentEvent,
|
|
101
|
+
isLiveLifecycleEvent,
|
|
109
102
|
measuredUsage,
|
|
103
|
+
modelKeyRefusedSentence,
|
|
104
|
+
providerResetSentence,
|
|
105
|
+
providerRetryNotice,
|
|
106
|
+
resolveEmptyTurnRetries,
|
|
110
107
|
rowIdOf,
|
|
111
108
|
storeSupportsDraftPersistence,
|
|
109
|
+
streamWithModelFailover,
|
|
110
|
+
summarizeFailoverReason,
|
|
112
111
|
transformVisibleTextParts
|
|
113
|
-
} from "../chunk-
|
|
112
|
+
} from "../chunk-RNDWCT4O.js";
|
|
113
|
+
import "../chunk-QUV5M7SZ.js";
|
|
114
114
|
import "../chunk-WGT32NQ4.js";
|
|
115
115
|
import "../chunk-YG66IHDU.js";
|
|
116
116
|
import {
|
|
@@ -124,7 +124,7 @@ import {
|
|
|
124
124
|
mergePersistedPart
|
|
125
125
|
} from "../chunk-JM6ANMOA.js";
|
|
126
126
|
import "../chunk-TB6KNPFI.js";
|
|
127
|
-
import "../chunk-
|
|
127
|
+
import "../chunk-2IGXFHUO.js";
|
|
128
128
|
import "../chunk-ALIWB2P3.js";
|
|
129
129
|
import {
|
|
130
130
|
DEFAULT_STALE_TURN_LOCK_GRACE_MS,
|