@lobu/runtime-device 20.0.0 → 20.0.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/dist/component.json +1 -1
- package/dist/dependencies.bun.lock +5 -5
- package/npm-shrinkwrap.json +23 -23
- package/package.json +1 -1
- package/vendor/cli/dist/commands/_lib/apply/apply-cmd.js +14 -4
- package/vendor/cli/dist/commands/_lib/apply/deployment.js +1 -1
- package/vendor/cli/dist/commands/_lib/apply/desired-state.d.ts +10 -3
- package/vendor/cli/dist/commands/_lib/apply/desired-state.js +45 -6
- package/vendor/cli/dist/commands/_lib/apply/diff.d.ts +3 -0
- package/vendor/cli/dist/commands/_lib/apply/diff.js +10 -3
- package/vendor/cli/dist/commands/_lib/apply/map-config.js +17 -12
- package/vendor/cli/dist/commands/_lib/apply/shared.d.ts +6 -2
- package/vendor/cli/dist/commands/_lib/apply/shared.js +11 -4
- package/vendor/cli/dist/commands/call.js +9 -3
- package/vendor/cli/dist/commands/dev.js +2 -1
- package/vendor/cli/dist/commands/doctor.d.ts +6 -0
- package/vendor/cli/dist/commands/doctor.js +26 -0
- package/vendor/cli/dist/commands/init.d.ts +3 -1
- package/vendor/cli/dist/commands/init.js +26 -15
- package/vendor/cli/dist/commands/memory/_lib/mcp.d.ts +0 -6
- package/vendor/cli/dist/commands/memory/_lib/mcp.js +1 -14
- package/vendor/cli/dist/commands/org.js +8 -0
- package/vendor/cli/dist/commands/whoami.d.ts +1 -0
- package/vendor/cli/dist/commands/whoami.js +10 -4
- package/vendor/cli/dist/config/define.d.ts +21 -6
- package/vendor/cli/dist/config/define.js +4 -0
- package/vendor/cli/dist/connectors/chat-automation-events.ts +33 -0
- package/vendor/cli/dist/connectors/discord.ts +2 -0
- package/vendor/cli/dist/connectors/gchat.ts +2 -0
- package/vendor/cli/dist/connectors/google_drive.ts +210 -40
- package/vendor/cli/dist/connectors/slack-automation-events.ts +0 -31
- package/vendor/cli/dist/connectors/slack.ts +2 -2
- package/vendor/cli/dist/connectors/teams.ts +2 -0
- package/vendor/cli/dist/connectors/telegram.ts +2 -0
- package/vendor/cli/dist/connectors/whatsapp.ts +2 -0
- package/vendor/cli/dist/index.js +3 -1
- package/vendor/cli/dist/internal/gateway-url.d.ts +4 -4
- package/vendor/cli/dist/internal/gateway-url.js +4 -4
- package/vendor/cli/dist/mac-auth.js +3 -1
- package/vendor/cli/dist/runtime-components.json +4 -4
- package/vendor/cli/package.json +1 -1
- package/vendor/connector-sdk/dist/index.d.ts +1 -1
- package/vendor/connector-sdk/dist/logger.js +4 -1
- package/vendor/connector-sdk/dist/reaction-sdk.d.ts +9 -0
- package/vendor/connector-sdk/package.json +1 -1
- package/vendor/connector-worker/dist/agent-turn/guest.bundle.js +13 -1
- package/vendor/connector-worker/dist/agent-turn/workspace.d.ts +9 -0
- package/vendor/connector-worker/dist/agent-turn/workspace.js +27 -1
- package/vendor/connector-worker/dist/daemon/client.d.ts +8 -2
- package/vendor/connector-worker/dist/daemon/client.js +3 -2
- package/vendor/connector-worker/dist/daemon/poll-loop.d.ts +1 -0
- package/vendor/connector-worker/dist/daemon/poll-loop.js +20 -2
- package/vendor/connector-worker/package.json +1 -1
- package/vendor/core/dist/contracts/tools/manage-automations.d.ts +16 -0
- package/vendor/core/dist/contracts/tools/manage-automations.js +12 -3
- package/vendor/core/dist/contracts/worker/protocol.d.ts +9 -0
- package/vendor/core/dist/contracts/worker/protocol.js +10 -1
- package/vendor/core/dist/logger.js +4 -2
- package/vendor/core/package.json +1 -1
|
@@ -22,6 +22,15 @@ import { enforceBashCommandPolicy, isDirectPackageInstallCommand } from '@lobu/c
|
|
|
22
22
|
import { Bash, InMemoryFs } from 'just-bash/browser';
|
|
23
23
|
/** Where a turn's files live; also the shell's working directory. */
|
|
24
24
|
export const WORKSPACE_ROOT = '/workspace';
|
|
25
|
+
/**
|
|
26
|
+
* Total bytes the write and edit tools may place in one turn's workspace: an
|
|
27
|
+
* eighth of the isolate's default 512MB heap, and far above a real turn's
|
|
28
|
+
* files (the largest session transcript measured across 2050 real rows is
|
|
29
|
+
* 633KB, `gateway/services/transcript-snapshot.ts`). A runaway write then
|
|
30
|
+
* refuses with an error the model can act on, instead of an OOM that kills
|
|
31
|
+
* the whole turn.
|
|
32
|
+
*/
|
|
33
|
+
export const WORKSPACE_WRITE_BUDGET_BYTES = 64 * 1024 * 1024;
|
|
25
34
|
/**
|
|
26
35
|
* Where the turn's own attachments are seeded. The name is part of the
|
|
27
36
|
* agent-visible contract: the system prompt lists each upload by this path.
|
|
@@ -210,9 +219,26 @@ export function createWorkspace(names, bashPolicy, remote) {
|
|
|
210
219
|
};
|
|
211
220
|
// Pi owns mutation ordering, matching, cancellation, and result formatting.
|
|
212
221
|
// Only filesystem access changes: every operation stays in this turn's tree.
|
|
222
|
+
// Writes are charged as deltas against WORKSPACE_WRITE_BUDGET_BYTES, so
|
|
223
|
+
// rewriting one file in a loop does not accumulate. Only bytes these two
|
|
224
|
+
// tools place are counted: a host-seeded file costs nothing until a tool
|
|
225
|
+
// rewrites it, and bash redirection writes through just-bash's own
|
|
226
|
+
// filesystem rather than this layer, so the isolate memory limit stays the
|
|
227
|
+
// backstop there.
|
|
228
|
+
const writeSizes = new Map();
|
|
229
|
+
let writtenBytes = 0;
|
|
213
230
|
const writeFile = async (path, content) => {
|
|
214
231
|
await ready;
|
|
215
|
-
|
|
232
|
+
const absolute = resolve(path);
|
|
233
|
+
const newSize = Buffer.byteLength(content);
|
|
234
|
+
const previousSize = writeSizes.get(absolute) ?? 0;
|
|
235
|
+
const projected = writtenBytes - previousSize + newSize;
|
|
236
|
+
if (projected > WORKSPACE_WRITE_BUDGET_BYTES) {
|
|
237
|
+
throw new Error(`Refusing to write ${formatSize(newSize)} to ${path}: this turn's workspace is limited to ${formatSize(WORKSPACE_WRITE_BUDGET_BYTES)} total and already holds ${formatSize(writtenBytes)}. Write smaller content or split it across turns.`);
|
|
238
|
+
}
|
|
239
|
+
await fs.writeFile(absolute, content);
|
|
240
|
+
writeSizes.set(absolute, newSize);
|
|
241
|
+
writtenBytes = projected;
|
|
216
242
|
};
|
|
217
243
|
// Host-placed files. Bytes go in as a Uint8Array rather than a string: a
|
|
218
244
|
// decoded-to-UTF-8 round trip would corrupt every attachment that is not
|
|
@@ -12,7 +12,10 @@ export declare function trimTrailingSlashes(value: string): string;
|
|
|
12
12
|
*/
|
|
13
13
|
export interface ExecutorClient {
|
|
14
14
|
readonly id: string;
|
|
15
|
-
poll(capacityAvailable?: number
|
|
15
|
+
poll(capacityAvailable?: number, options?: {
|
|
16
|
+
waitSeconds?: number;
|
|
17
|
+
signal?: AbortSignal;
|
|
18
|
+
}): Promise<PollResponse>;
|
|
16
19
|
/**
|
|
17
20
|
* Beat, and read what the gateway says back. The response is the only channel
|
|
18
21
|
* into a run this worker already holds: `continue: false` means stop.
|
|
@@ -161,7 +164,10 @@ export declare class WorkerClient implements ExecutorClient {
|
|
|
161
164
|
/**
|
|
162
165
|
* Poll for available runs
|
|
163
166
|
*/
|
|
164
|
-
poll(capacityAvailable?: number
|
|
167
|
+
poll(capacityAvailable?: number, options?: {
|
|
168
|
+
waitSeconds?: number;
|
|
169
|
+
signal?: AbortSignal;
|
|
170
|
+
}): Promise<PollResponse>;
|
|
165
171
|
/**
|
|
166
172
|
* Send heartbeat for active run
|
|
167
173
|
*/
|
|
@@ -169,7 +169,7 @@ export class WorkerClient {
|
|
|
169
169
|
/**
|
|
170
170
|
* Poll for available runs
|
|
171
171
|
*/
|
|
172
|
-
async poll(capacityAvailable) {
|
|
172
|
+
async poll(capacityAvailable, options) {
|
|
173
173
|
const advertisement = this.advertisementProvider?.snapshot();
|
|
174
174
|
const capabilities = advertisement
|
|
175
175
|
? { ...this.advertisedCapabilities(), ...advertisement.capabilities }
|
|
@@ -177,6 +177,7 @@ export class WorkerClient {
|
|
|
177
177
|
const manifests = advertisement?.manifests ?? this.manifests;
|
|
178
178
|
return this.requestJson('/api/workers/poll', {
|
|
179
179
|
worker_id: this.workerId,
|
|
180
|
+
...(options?.waitSeconds === undefined ? {} : { wait_seconds: options.waitSeconds }),
|
|
180
181
|
capabilities,
|
|
181
182
|
version: this.version,
|
|
182
183
|
...(capacityAvailable === undefined
|
|
@@ -199,7 +200,7 @@ export class WorkerClient {
|
|
|
199
200
|
...(this.advertisementProvider || manifests.length > 0
|
|
200
201
|
? { connector_manifests: manifests }
|
|
201
202
|
: {}),
|
|
202
|
-
});
|
|
203
|
+
}, options?.signal);
|
|
203
204
|
}
|
|
204
205
|
/**
|
|
205
206
|
* Send heartbeat for active run
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* polling, concurrency, and graceful-shutdown lifecycle. Run execution stays
|
|
6
6
|
* injected so the device build does not import fleet connector machinery.
|
|
7
7
|
*/
|
|
8
|
+
import { WORKER_POLL_MAX_WAIT_SECONDS } from '@lobu/core/contracts/worker/protocol';
|
|
8
9
|
import { WorkerHttpError } from './client.js';
|
|
9
10
|
import { log } from './log.js';
|
|
10
11
|
export function shouldHandleWorkerPollLoopStdinEof(options = {}) {
|
|
@@ -23,6 +24,7 @@ export class WorkerPollLoop {
|
|
|
23
24
|
activeJobs = 0;
|
|
24
25
|
capacityVersion = 0;
|
|
25
26
|
wakePoll;
|
|
27
|
+
pendingPoll;
|
|
26
28
|
constructor(options) {
|
|
27
29
|
this.client = options.client;
|
|
28
30
|
this.pollIntervalMs = options.pollIntervalMs ?? 10000;
|
|
@@ -57,6 +59,8 @@ export class WorkerPollLoop {
|
|
|
57
59
|
nextDelayMs = await this.pollAndExecute();
|
|
58
60
|
}
|
|
59
61
|
catch (err) {
|
|
62
|
+
if (!this.running)
|
|
63
|
+
break;
|
|
60
64
|
// Server errors retain their retry backoff even if a slot opens.
|
|
61
65
|
capacityVersion = undefined;
|
|
62
66
|
if (this.failClosedOnPollAuthError &&
|
|
@@ -80,6 +84,7 @@ export class WorkerPollLoop {
|
|
|
80
84
|
log.info('[daemon] Stopping...');
|
|
81
85
|
this.running = false;
|
|
82
86
|
this.admittingJobs = false;
|
|
87
|
+
this.pendingPoll?.abort();
|
|
83
88
|
this.wakePoll?.();
|
|
84
89
|
}
|
|
85
90
|
async waitForActiveJobs(timeoutMs = 30000, pollMs = 500) {
|
|
@@ -101,13 +106,26 @@ export class WorkerPollLoop {
|
|
|
101
106
|
if (!this.admittingJobs)
|
|
102
107
|
return undefined;
|
|
103
108
|
const capacityAvailable = Math.max(0, this.maxConcurrentJobs - this.activeJobs);
|
|
104
|
-
const
|
|
109
|
+
const controller = new AbortController();
|
|
110
|
+
this.pendingPoll = controller;
|
|
111
|
+
let job;
|
|
112
|
+
try {
|
|
113
|
+
job = await this.client.poll(capacityAvailable, {
|
|
114
|
+
// A worker with no free slot must not hold the request: it cannot take
|
|
115
|
+
// the run the hold would return.
|
|
116
|
+
waitSeconds: capacityAvailable > 0 ? WORKER_POLL_MAX_WAIT_SECONDS : 0,
|
|
117
|
+
signal: controller.signal,
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
finally {
|
|
121
|
+
this.pendingPoll = undefined;
|
|
122
|
+
}
|
|
105
123
|
if (!job.run_id) {
|
|
106
124
|
if (!this.admittingJobs)
|
|
107
125
|
return undefined;
|
|
108
126
|
const nextPoll = job.next_poll_seconds ?? 30;
|
|
109
127
|
log.debug(`[daemon] No runs available, next poll in ${nextPoll}s`);
|
|
110
|
-
return Number.isFinite(nextPoll) && nextPoll
|
|
128
|
+
return Number.isFinite(nextPoll) && nextPoll >= 0 ? nextPoll * 1000 : 1000;
|
|
111
129
|
}
|
|
112
130
|
// A zero-capacity response should be impossible: the server must not enter
|
|
113
131
|
// a claim lane when the worker truthfully reports no free slot. Do not
|
|
@@ -135,7 +135,18 @@ export declare const AutomationOutputSchema: import("@sinclair/typebox").TUnion<
|
|
|
135
135
|
export type AutomationOutput = Static<typeof AutomationOutputSchema>;
|
|
136
136
|
export declare const AutomationOutputsSchema: import("@sinclair/typebox").TObject<{}>;
|
|
137
137
|
export type AutomationOutputs = Record<string, AutomationOutput>;
|
|
138
|
+
export declare const AutomationScriptExecutorSchema: import("@sinclair/typebox").TObject<{
|
|
139
|
+
kind: import("@sinclair/typebox").TLiteral<"script">;
|
|
140
|
+
source: import("@sinclair/typebox").TString;
|
|
141
|
+
params: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TUnknown>>;
|
|
142
|
+
}>;
|
|
143
|
+
export type AutomationScriptExecutor = Static<typeof AutomationScriptExecutorSchema>;
|
|
138
144
|
export declare const AutomationExecutionConfigSchema: import("@sinclair/typebox").TObject<{
|
|
145
|
+
executor: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
|
146
|
+
kind: import("@sinclair/typebox").TLiteral<"script">;
|
|
147
|
+
source: import("@sinclair/typebox").TString;
|
|
148
|
+
params: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TUnknown>>;
|
|
149
|
+
}>>;
|
|
139
150
|
timeout_seconds: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
|
|
140
151
|
max_budget_usd: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
141
152
|
model: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
@@ -248,6 +259,11 @@ export declare const ManageAutomationsSchema: import("@sinclair/typebox").TObjec
|
|
|
248
259
|
min_cooldown_seconds: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
249
260
|
model_config: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TAny>;
|
|
250
261
|
execution_config: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TNull, import("@sinclair/typebox").TObject<{
|
|
262
|
+
executor: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
|
263
|
+
kind: import("@sinclair/typebox").TLiteral<"script">;
|
|
264
|
+
source: import("@sinclair/typebox").TString;
|
|
265
|
+
params: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TUnknown>>;
|
|
266
|
+
}>>;
|
|
251
267
|
timeout_seconds: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
|
|
252
268
|
max_budget_usd: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
253
269
|
model: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ListAutomationsResultSchema = exports.ListAutomationsSchema = exports.ManageAutomationsResultSchema = exports.AutomationTriggerResultSchema = exports.AutomationTriggerExecutionSchema = exports.AutomationClaimNextWindowResultSchema = exports.AutomationClaimNextWindowContextSchema = exports.ManageAutomationsPromotedEntitySchema = exports.ManageAutomationsFeedbackItemSchema = exports.ManageAutomationsDeleteResultSchema = exports.ManageAutomationsSchema = exports.AutomationSkillSchema = exports.SourceSchema = exports.AutomationDeliveryTargetSchema = exports.AutomationExecutionConfigSchema = exports.AutomationOutputsSchema = exports.AutomationOutputSchema = exports.AutomationEventOutputSchema = exports.AutomationEntityOutputSchema = exports.AutomationSourceSchema = exports.AutomationTriggerSchema = exports.AutomationScheduleTriggerSchema = exports.AutomationWorkspaceEventTriggerSchema = exports.AutomationEventTriggerSchema = void 0;
|
|
3
|
+
exports.ListAutomationsResultSchema = exports.ListAutomationsSchema = exports.ManageAutomationsResultSchema = exports.AutomationTriggerResultSchema = exports.AutomationTriggerExecutionSchema = exports.AutomationClaimNextWindowResultSchema = exports.AutomationClaimNextWindowContextSchema = exports.ManageAutomationsPromotedEntitySchema = exports.ManageAutomationsFeedbackItemSchema = exports.ManageAutomationsDeleteResultSchema = exports.ManageAutomationsSchema = exports.AutomationSkillSchema = exports.SourceSchema = exports.AutomationDeliveryTargetSchema = exports.AutomationExecutionConfigSchema = exports.AutomationScriptExecutorSchema = exports.AutomationOutputsSchema = exports.AutomationOutputSchema = exports.AutomationEventOutputSchema = exports.AutomationEntityOutputSchema = exports.AutomationSourceSchema = exports.AutomationTriggerSchema = exports.AutomationScheduleTriggerSchema = exports.AutomationWorkspaceEventTriggerSchema = exports.AutomationEventTriggerSchema = void 0;
|
|
4
4
|
exports.resolvedEventExecution = resolvedEventExecution;
|
|
5
5
|
exports.normalizeWorkspaceEventTrigger = normalizeWorkspaceEventTrigger;
|
|
6
6
|
exports.normalizeAutomationTags = normalizeAutomationTags;
|
|
@@ -202,7 +202,16 @@ exports.AutomationOutputsSchema = typebox_1.Type.Object({}, {
|
|
|
202
202
|
maxProperties: 20,
|
|
203
203
|
description: "Named top-level arrays persisted after a completed window. Entity outputs are validated against their entity type; event rows require content and may include title, metadata, author, source_url, occurred_at, parent_event_id, payload_type, and idempotency_key.",
|
|
204
204
|
});
|
|
205
|
+
exports.AutomationScriptExecutorSchema = typebox_1.Type.Object({
|
|
206
|
+
kind: typebox_1.Type.Literal("script"),
|
|
207
|
+
source: typebox_1.Type.String({ minLength: 1, maxLength: 131072 }),
|
|
208
|
+
params: typebox_1.Type.Optional(typebox_1.Type.Record(typebox_1.Type.String(), typebox_1.Type.Unknown())),
|
|
209
|
+
}, {
|
|
210
|
+
additionalProperties: false,
|
|
211
|
+
description: "Run this TypeScript module directly in the Automation sandbox. Export default async (ctx, client). The runtime pins the script and window at activation and completes the run only after success. SDK writes retain the owning agent's permissions. Use ctx.window.run_id for retry idempotency.",
|
|
212
|
+
});
|
|
205
213
|
exports.AutomationExecutionConfigSchema = typebox_1.Type.Object({
|
|
214
|
+
executor: typebox_1.Type.Optional(exports.AutomationScriptExecutorSchema),
|
|
206
215
|
timeout_seconds: typebox_1.Type.Optional(typebox_1.Type.Integer({
|
|
207
216
|
minimum: 1,
|
|
208
217
|
maximum: 86400,
|
|
@@ -235,7 +244,7 @@ exports.AutomationExecutionConfigSchema = typebox_1.Type.Object({
|
|
|
235
244
|
})),
|
|
236
245
|
}, {
|
|
237
246
|
additionalProperties: false,
|
|
238
|
-
description: "[create/update] Per-Automation execution settings: device-worker CLI flags
|
|
247
|
+
description: "[create/update] Per-Automation execution settings: a sandboxed script executor, device-worker CLI flags, or the server-side finalize-nudge budget. Omitted fields fall back to dispatcher/CLI/global defaults; pass null to clear.",
|
|
239
248
|
});
|
|
240
249
|
exports.AutomationDeliveryTargetSchema = typebox_1.Type.Object({
|
|
241
250
|
connection_id: typebox_1.Type.Integer({
|
|
@@ -423,7 +432,7 @@ exports.ManageAutomationsSchema = typebox_1.Type.Object({
|
|
|
423
432
|
})),
|
|
424
433
|
// Automation config fields (create/create_version/update)
|
|
425
434
|
prompt: typebox_1.Type.Optional(typebox_1.Type.String({
|
|
426
|
-
description: "[create/create_version] Literal LLM instruction text for the Automation — the task statement, frozen into the version. No template expansion happens: the text is delivered to the agent verbatim, and the window's data (content, sources, entities, extraction_schema) arrives alongside it in the knowledge-read payload. Reusable know-how belongs in `skills` instead, which is delivered as readable files rather than pasted in here. A schedule trigger, an event trigger with execution 'window', and an Automation with no triggers each need an instruction source — supply `prompt`, `skills`, or
|
|
435
|
+
description: "[create/create_version] Literal LLM instruction text for the Automation — the task statement, frozen into the version. No template expansion happens: the text is delivered to the agent verbatim, and the window's data (content, sources, entities, extraction_schema) arrives alongside it in the knowledge-read payload. Reusable know-how belongs in `skills` instead, which is delivered as readable files rather than pasted in here. A schedule trigger, an event trigger with execution 'window', and an Automation with no triggers each need an instruction source — supply `prompt`, `skills`, a reaction script, or a script executor; an event trigger with execution 'turn' may omit all instruction sources and use the built-in default.",
|
|
427
436
|
})),
|
|
428
437
|
skills: typebox_1.Type.Optional(typebox_1.Type.Array(exports.AutomationSkillSchema, {
|
|
429
438
|
maxItems: 5,
|
|
@@ -83,9 +83,18 @@ export declare const FeedNotificationSchema: import("@sinclair/typebox").TObject
|
|
|
83
83
|
notification_id: import("@sinclair/typebox").TString;
|
|
84
84
|
changed: import("@sinclair/typebox").TBoolean;
|
|
85
85
|
}>;
|
|
86
|
+
/**
|
|
87
|
+
* Ceiling on how long the gateway holds an empty claim request. A client that
|
|
88
|
+
* asks for more is rejected, so the client's own hold MUST be read from here
|
|
89
|
+
* rather than restated: the two are one contract, and a client-side literal
|
|
90
|
+
* above the schema maximum 400s every poll — a total dispatch outage.
|
|
91
|
+
*/
|
|
92
|
+
export declare const WORKER_POLL_MAX_WAIT_SECONDS = 25;
|
|
86
93
|
/** `POST /api/workers/poll` request body. */
|
|
87
94
|
export declare const PollRequestSchema: import("@sinclair/typebox").TObject<{
|
|
88
95
|
worker_id: import("@sinclair/typebox").TString;
|
|
96
|
+
/** Maximum time to hold an empty claim request; available work returns immediately. */
|
|
97
|
+
wait_seconds: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
|
|
89
98
|
capabilities: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TBoolean>>;
|
|
90
99
|
/** Number of additional runs the worker can accept at this instant. */
|
|
91
100
|
capacity_available: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
* not change that boundary, it only types what already crosses it.
|
|
27
27
|
*/
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.HeartbeatResponseSchema = exports.DispatchChromeActionResponseSchema = exports.DispatchChromeActionRequestSchema = exports.HeartbeatRequestSchema = exports.AGENT_TURN_BRIDGE_BYTES = exports.TURN_DELTA_MAX_CHARS = exports.PollAuthSignalResponseSchema = exports.PollAuthSignalRequestSchema = exports.EmitAuthArtifactRequestSchema = exports.CompleteAgentTurnResponseSchema = exports.CompleteAgentTurnRequestSchema = exports.AGENT_TURN_INPUT_MAX = exports.TURN_TOOL_EVENT_QUEUE_MAX = exports.TurnToolEventSchema = exports.TURN_TOOL_OUTPUT_MAX_CHARS = exports.CompleteDeviceChatResponseSchema = exports.CompleteDeviceChatRequestSchema = exports.CompleteAutomationResponseSchema = exports.CompleteAutomationRequestSchema = exports.CompleteAuthRequestSchema = exports.CompleteEmbeddingsRequestSchema = exports.EmbeddingEntrySchema = exports.EmbedEventSchema = exports.CompleteActionRequestSchema = exports.CompleteRequestSchema = exports.StreamBatchSchema = exports.ContentItemSchema = exports.ActivatePageResponseSchema = exports.ActivatePageRequestSchema = exports.PollResponseSchema = exports.FeedSourceAckSchema = exports.AgentTurnPollPayloadSchema = exports.DeviceChatPollPayloadSchema = exports.DEVICE_CHAT_MAX_CONTEXT_LENGTH = exports.DeviceChatHistoryMessageSchema = exports.AutomationPollPayloadSchema = exports.AutomationPollContextSchema = exports.AutomationPollEventSchema = exports.AutomationPollMetaSchema = exports.AutomationExecutionConfigSchema = exports.PollRequestSchema = exports.FeedNotificationSchema = exports.EXECUTION_BACKENDS = exports.OAuthCredentialsSchema = exports.WorkerExitDiagnosticsSchema = exports.WorkerExitReasonSchema = exports.RunTypeSchema = void 0;
|
|
29
|
+
exports.HeartbeatResponseSchema = exports.DispatchChromeActionResponseSchema = exports.DispatchChromeActionRequestSchema = exports.HeartbeatRequestSchema = exports.AGENT_TURN_BRIDGE_BYTES = exports.TURN_DELTA_MAX_CHARS = exports.PollAuthSignalResponseSchema = exports.PollAuthSignalRequestSchema = exports.EmitAuthArtifactRequestSchema = exports.CompleteAgentTurnResponseSchema = exports.CompleteAgentTurnRequestSchema = exports.AGENT_TURN_INPUT_MAX = exports.TURN_TOOL_EVENT_QUEUE_MAX = exports.TurnToolEventSchema = exports.TURN_TOOL_OUTPUT_MAX_CHARS = exports.CompleteDeviceChatResponseSchema = exports.CompleteDeviceChatRequestSchema = exports.CompleteAutomationResponseSchema = exports.CompleteAutomationRequestSchema = exports.CompleteAuthRequestSchema = exports.CompleteEmbeddingsRequestSchema = exports.EmbeddingEntrySchema = exports.EmbedEventSchema = exports.CompleteActionRequestSchema = exports.CompleteRequestSchema = exports.StreamBatchSchema = exports.ContentItemSchema = exports.ActivatePageResponseSchema = exports.ActivatePageRequestSchema = exports.PollResponseSchema = exports.FeedSourceAckSchema = exports.AgentTurnPollPayloadSchema = exports.DeviceChatPollPayloadSchema = exports.DEVICE_CHAT_MAX_CONTEXT_LENGTH = exports.DeviceChatHistoryMessageSchema = exports.AutomationPollPayloadSchema = exports.AutomationPollContextSchema = exports.AutomationPollEventSchema = exports.AutomationPollMetaSchema = exports.AutomationExecutionConfigSchema = exports.PollRequestSchema = exports.WORKER_POLL_MAX_WAIT_SECONDS = exports.FeedNotificationSchema = exports.EXECUTION_BACKENDS = exports.OAuthCredentialsSchema = exports.WorkerExitDiagnosticsSchema = exports.WorkerExitReasonSchema = exports.RunTypeSchema = void 0;
|
|
30
30
|
exports.defaultBackendCapacity = defaultBackendCapacity;
|
|
31
31
|
const typebox_1 = require("@sinclair/typebox");
|
|
32
32
|
// Wire mirror of connector-sdk's ConnectorAutomationSignalDraftSchema. Core is
|
|
@@ -132,9 +132,18 @@ exports.FeedNotificationSchema = typebox_1.Type.Object({
|
|
|
132
132
|
notification_id: typebox_1.Type.String({ minLength: 1, maxLength: 200 }),
|
|
133
133
|
changed: typebox_1.Type.Boolean(),
|
|
134
134
|
});
|
|
135
|
+
/**
|
|
136
|
+
* Ceiling on how long the gateway holds an empty claim request. A client that
|
|
137
|
+
* asks for more is rejected, so the client's own hold MUST be read from here
|
|
138
|
+
* rather than restated: the two are one contract, and a client-side literal
|
|
139
|
+
* above the schema maximum 400s every poll — a total dispatch outage.
|
|
140
|
+
*/
|
|
141
|
+
exports.WORKER_POLL_MAX_WAIT_SECONDS = 25;
|
|
135
142
|
/** `POST /api/workers/poll` request body. */
|
|
136
143
|
exports.PollRequestSchema = typebox_1.Type.Object({
|
|
137
144
|
worker_id: typebox_1.Type.String(),
|
|
145
|
+
/** Maximum time to hold an empty claim request; available work returns immediately. */
|
|
146
|
+
wait_seconds: typebox_1.Type.Optional(typebox_1.Type.Integer({ minimum: 0, maximum: exports.WORKER_POLL_MAX_WAIT_SECONDS })),
|
|
138
147
|
capabilities: typebox_1.Type.Optional(typebox_1.Type.Record(typebox_1.Type.String(), typebox_1.Type.Boolean())),
|
|
139
148
|
/** Number of additional runs the worker can accept at this instant. */
|
|
140
149
|
capacity_available: typebox_1.Type.Optional(typebox_1.Type.Integer({ minimum: 0, maximum: 1024 })),
|
|
@@ -59,9 +59,11 @@ function createConsoleLogger(serviceName) {
|
|
|
59
59
|
!Array.isArray(message) &&
|
|
60
60
|
!(message instanceof Error)) {
|
|
61
61
|
if (args.length > 0 && typeof args[0] === "string") {
|
|
62
|
-
//
|
|
62
|
+
// Keep the metadata object as a trailing arg so it still renders.
|
|
63
|
+
// Slicing it away accepted the signature and then dropped the payload,
|
|
64
|
+
// emptying every structured diagnostic that uses this call shape.
|
|
63
65
|
msgStr = args[0];
|
|
64
|
-
args = args.slice(1);
|
|
66
|
+
args = [message, ...args.slice(1)];
|
|
65
67
|
}
|
|
66
68
|
else {
|
|
67
69
|
// Just an object, stringify it
|