@opengeni/worker-bundle 0.17.2 → 0.20.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/activities/agent-run-admission.d.ts +12 -0
- package/dist/activities/agent-turn.d.ts +49 -1
- package/dist/activities/browser-state-artifact-reaper.d.ts +29 -0
- package/dist/activities/capabilities.d.ts +6 -0
- package/dist/activities/codex-capacity.d.ts +1 -0
- package/dist/activities/environment.d.ts +7 -1
- package/dist/activities/packs.d.ts +8 -10
- package/dist/activities/run-input.d.ts +8 -0
- package/dist/activities/session-state.d.ts +7 -3
- package/dist/activities/site-auth-maintenance.d.ts +27 -0
- package/dist/activities/types.d.ts +43 -0
- package/dist/activities/video-generation-admission.d.ts +9 -4
- package/dist/activities/video-generation-credential.d.ts +17 -0
- package/dist/activities/video-reference-staging.d.ts +7 -1
- package/dist/activities/xai-auth.d.ts +23 -0
- package/dist/activities/xai-image-generation.d.ts +26 -0
- package/dist/activities/xai-video-generation.d.ts +18 -0
- package/dist/{activities-control-44KBWLSM.js → activities-control-SMKF2OBE.js} +438 -55
- package/dist/activities-control-SMKF2OBE.js.map +1 -0
- package/dist/activities-control.d.ts +10 -2
- package/dist/{activities-turn-K4CEDEGJ.js → activities-turn-IDS3WEHA.js} +6704 -4847
- package/dist/activities-turn-IDS3WEHA.js.map +1 -0
- package/dist/activities.d.ts +11 -3
- package/dist/{chunk-E3RI3I33.js → chunk-N5TJIFCE.js} +156 -10
- package/dist/chunk-N5TJIFCE.js.map +1 -0
- package/dist/{chunk-KKCRGAGZ.js → chunk-P6Z2SLAA.js} +99 -98
- package/dist/chunk-P6Z2SLAA.js.map +1 -0
- package/dist/index.d.ts +14 -1
- package/dist/index.js +49 -2
- package/dist/index.js.map +1 -1
- package/dist/model-checkpoint-memory-collector.d.ts +1 -0
- package/dist/model-context-contributions.d.ts +40 -0
- package/dist/observability-metrics.d.ts +57 -1
- package/dist/sandbox-routing.d.ts +4 -0
- package/dist/workflow-bundle.js +232 -18
- package/dist/workflows/activities.d.ts +1 -1
- package/dist/workflows/session.d.ts +17 -1
- package/dist/workflows/site-auth-maintenance.d.ts +2 -0
- package/dist/workflows.d.ts +1 -0
- package/package.json +16 -15
- package/src/activities/agent-run-admission.ts +76 -0
- package/src/activities/agent-turn.ts +2777 -1241
- package/src/activities/browser-state-artifact-reaper.ts +120 -0
- package/src/activities/capabilities.ts +10 -0
- package/src/activities/codex-capacity.ts +48 -1
- package/src/activities/environment.ts +14 -8
- package/src/activities/goals.ts +2 -1
- package/src/activities/packs.ts +45 -122
- package/src/activities/parent-wake.ts +13 -1
- package/src/activities/run-input.ts +137 -45
- package/src/activities/scheduled-tasks.ts +30 -73
- package/src/activities/session-state.ts +87 -5
- package/src/activities/site-auth-maintenance.ts +269 -0
- package/src/activities/types.ts +44 -0
- package/src/activities/video-generation-admission.ts +37 -4
- package/src/activities/video-generation-credential.ts +84 -6
- package/src/activities/video-generation-reconciliation.ts +212 -19
- package/src/activities/video-media-validation.ts +8 -2
- package/src/activities/video-reference-staging.ts +121 -34
- package/src/activities/xai-auth.ts +122 -0
- package/src/activities/xai-image-generation.ts +86 -0
- package/src/activities/xai-video-generation.ts +69 -0
- package/src/activities-control.ts +4 -0
- package/src/activities.ts +7 -0
- package/src/index.ts +51 -0
- package/src/model-checkpoint-memory-collector.ts +8 -1
- package/src/model-context-contributions.ts +159 -0
- package/src/observability-metrics.ts +282 -12
- package/src/sandbox-routing.ts +13 -0
- package/src/workflows/activities.ts +1 -0
- package/src/workflows/file-upload-reaper.ts +8 -2
- package/src/workflows/session.ts +219 -14
- package/src/workflows/site-auth-maintenance.ts +14 -0
- package/src/workflows.ts +1 -0
- package/dist/activities-control-44KBWLSM.js.map +0 -1
- package/dist/activities-turn-K4CEDEGJ.js.map +0 -1
- package/dist/chunk-E3RI3I33.js.map +0 -1
- package/dist/chunk-KKCRGAGZ.js.map +0 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type SessionEventType } from "@opengeni/contracts";
|
|
2
2
|
import type { EventLogger } from "@opengeni/events";
|
|
3
3
|
import type { Observability } from "@opengeni/observability";
|
|
4
|
+
import type { CompanyBrainContributionReceipt } from "./model-context-contributions.js";
|
|
4
5
|
import { type RuntimeMetricsHooks, type SelfhostedOpObservation, type SelfhostedOpObserver } from "@opengeni/runtime";
|
|
5
6
|
export type TurnOutcome = "completed" | "failed" | "cancelled" | "recovering";
|
|
6
7
|
export type CreditMicrosKind = "usage" | "grant" | "topup" | "refund";
|
|
@@ -65,17 +66,19 @@ export declare function turnLifecycleMetricsFor(observability: Observability): T
|
|
|
65
66
|
export declare class TurnLifecycleMetrics {
|
|
66
67
|
private readonly observability;
|
|
67
68
|
private readonly options;
|
|
68
|
-
private readonly
|
|
69
|
+
private readonly turns;
|
|
69
70
|
private timer;
|
|
70
71
|
constructor(observability: Observability, options?: {
|
|
71
72
|
now?: () => number;
|
|
72
73
|
refreshIntervalMs?: number;
|
|
73
74
|
});
|
|
74
75
|
start(turnId: string): void;
|
|
76
|
+
progress(turnId: string): void;
|
|
75
77
|
finish(turnId: string, outcome: TurnOutcome | null, durationSeconds?: number): void;
|
|
76
78
|
refreshGauges(): void;
|
|
77
79
|
stop(): void;
|
|
78
80
|
private oldestInflightAgeSeconds;
|
|
81
|
+
private oldestNoProgressAgeSeconds;
|
|
79
82
|
private ensureTimer;
|
|
80
83
|
private stopTimer;
|
|
81
84
|
private now;
|
|
@@ -133,6 +136,54 @@ export declare const RETAINED_PROCESS_RECONCILIATION_OUTCOMES: readonly ["claim_
|
|
|
133
136
|
export type RetainedProcessReconciliationOutcome = (typeof RETAINED_PROCESS_RECONCILIATION_OUTCOMES)[number];
|
|
134
137
|
export declare function recordRetainedProcessReconciliation(observability: Observability, outcome: RetainedProcessReconciliationOutcome): void;
|
|
135
138
|
export declare function recordCreditMicros(observability: Observability | undefined, kind: CreditMicrosKind, amountMicros: number): void;
|
|
139
|
+
/**
|
|
140
|
+
* Record provider lifecycle diagnostics from the synchronous transport observer.
|
|
141
|
+
* Provider ids come from the resolved provider registry; phase/outcome are closed
|
|
142
|
+
* enums. This function never performs I/O outside the in-memory metrics registry.
|
|
143
|
+
*/
|
|
144
|
+
export declare function recordModelRequestPhase(observability: Observability, input: {
|
|
145
|
+
provider: string;
|
|
146
|
+
phase: "headers" | "first_byte" | "terminal";
|
|
147
|
+
outcome?: "completed" | "failed" | "timed_out";
|
|
148
|
+
durationSeconds: number;
|
|
149
|
+
}): void;
|
|
150
|
+
export type TurnStartupPhase = "claim_and_policy" | "turn_start_settlement" | "credential_selection" | "runtime_preparation" | "sandbox_establish" | "file_resolution" | "tool_context_preparation" | "tool_preparation" | "tool_server_construction" | "tool_required_connect" | "tool_optional_connect" | "tool_attempt_catalog_build" | "tool_attempt_catalog_persist" | "post_tool_preparation" | "agent_construction" | "post_agent_preparation" | "file_materialization" | "history_preparation" | "history_system_update_load" | "history_current_attachment_resolution" | "history_durable_history_load" | "history_sandbox_envelope_load" | "history_canonical_projection" | "history_provider_projection" | "history_attachment_ref_projection" | "history_screenshot_materialization" | "history_model_attachment_projection" | "history_runtime_input_assembly" | "history_artifact_candidate_scan" | "history_generated_image_materialization" | "history_position_load" | "owned_sandbox_setup" | "provider_dispatch" | "model_request_preparation" | "model_sdk_serialization" | "model_prepare_sandbox_agent_preparation" | "model_prepare_sandbox_agent_manifest_inventory" | "model_prepare_sandbox_session_manifest_inventory" | "model_prepare_sandbox_manifest_apply" | "model_prepare_sandbox_entry_materialization" | "model_prepare_sandbox_running_check" | "model_prepare_sandbox_start" | "model_prepare_sandbox_client_create" | "model_prepare_sandbox_client_resume" | "model_prepare_sandbox_client_delete" | "model_prepare_sandbox_client_state_serialize" | "model_prepare_sandbox_client_reuse_check" | "model_prepare_runner_before_mcp_tools" | "model_prepare_mcp_tools_snapshot" | "model_prepare_mcp_tools_before_input_filter" | "model_prepare_input_filter_base" | "model_prepare_input_filter_genesis" | "model_prepare_input_filter_host" | "model_prepare_input_filter_tool_output" | "model_prepare_input_filter_modality" | "model_prepare_input_filter_context" | "model_prepare_responses_input_conversion" | "model_prepare_responses_request_build" | "model_credential_resolution" | "model_wire_normalization" | "model_request_audit" | "stream_bootstrap";
|
|
151
|
+
export type TurnStartupOutcome = "completed" | "failed";
|
|
152
|
+
export type TurnStartupCache = "hit" | "miss" | "disabled" | "none";
|
|
153
|
+
export type TurnStartupCountBucket = "0" | "1" | "2-5" | "6-20" | "21+" | "unknown";
|
|
154
|
+
export type TurnSandboxEstablishPolicy = "eager" | "on-demand";
|
|
155
|
+
export type TurnSandboxEstablishReason = "eligible" | "lazy_disabled" | "machine_primary" | "backend_none" | "initial_run_credentials" | "generated_video_files" | "signed_file_resources";
|
|
156
|
+
export declare function turnStartupCountBucket(count: number | null): TurnStartupCountBucket;
|
|
157
|
+
/**
|
|
158
|
+
* Measure the critical path from a durable turn start to provider dispatch.
|
|
159
|
+
* Every label is a closed or configuration-derived enum; high-cardinality turn,
|
|
160
|
+
* session, credential, connection, file, and model identifiers are forbidden.
|
|
161
|
+
*/
|
|
162
|
+
export declare function recordTurnStartupPhase(observability: Observability, input: {
|
|
163
|
+
phase: TurnStartupPhase;
|
|
164
|
+
provider: string;
|
|
165
|
+
backend: string;
|
|
166
|
+
outcome: TurnStartupOutcome;
|
|
167
|
+
durationSeconds: number;
|
|
168
|
+
count?: number | null;
|
|
169
|
+
cache?: TurnStartupCache;
|
|
170
|
+
}): void;
|
|
171
|
+
/**
|
|
172
|
+
* Explain why a turn did or did not keep provider sandbox work off the
|
|
173
|
+
* pre-model critical path. The reason is a closed enum: never attach session,
|
|
174
|
+
* sandbox, credential, or file identifiers here.
|
|
175
|
+
*/
|
|
176
|
+
export declare function recordTurnSandboxEstablishPolicy(observability: Observability, input: {
|
|
177
|
+
policy: TurnSandboxEstablishPolicy;
|
|
178
|
+
reason: TurnSandboxEstablishReason;
|
|
179
|
+
backend: string;
|
|
180
|
+
}): void;
|
|
181
|
+
export declare function recordTurnWorkerPreparationTotal(observability: Observability, input: {
|
|
182
|
+
provider: string;
|
|
183
|
+
backend: string;
|
|
184
|
+
outcome: TurnStartupOutcome;
|
|
185
|
+
durationSeconds: number;
|
|
186
|
+
}): void;
|
|
136
187
|
export type StreamDeltaClass = "message" | "reasoning";
|
|
137
188
|
/**
|
|
138
189
|
* Per-turn stream-timing tracker fed every normalized runtime event in push order.
|
|
@@ -188,6 +239,11 @@ export declare function recordModelInputTokens(observability: Observability, pro
|
|
|
188
239
|
* | auto). The rate of this — against the input-tokens histogram above — is how an
|
|
189
240
|
* operator sees compaction working (or silently not). */
|
|
190
241
|
export declare function recordContextCompaction(observability: Observability, trigger: string): void;
|
|
242
|
+
/**
|
|
243
|
+
* Metadata-only Company Brain exposure telemetry. Labels are closed enums and
|
|
244
|
+
* never include tenant ids, record ids, titles, descriptions, or content.
|
|
245
|
+
*/
|
|
246
|
+
export declare function recordCompanyBrainContributions(observability: Observability, receipt: CompanyBrainContributionReceipt): void;
|
|
191
247
|
/**
|
|
192
248
|
* Prompt-cache efficiency of one model response, by provider. Reads from the SAME
|
|
193
249
|
* usage frame that feeds input-token accounting, so the two are always consistent:
|
|
@@ -68,6 +68,8 @@ export type RoutingWiringIds = {
|
|
|
68
68
|
* manifest environment variables." Optional → the resolver defaults to `{}`.
|
|
69
69
|
*/
|
|
70
70
|
environment?: Record<string, string>;
|
|
71
|
+
/** Attempt-local values projected only onto Connected Machine child execs. */
|
|
72
|
+
transientExecEnvironment?: () => Readonly<Record<string, string>>;
|
|
71
73
|
/**
|
|
72
74
|
* Stage D machine-primary: PIN the already-established turn SelfhostedSession
|
|
73
75
|
* (the `established` arg's session) for THIS machine pointer `(sandboxId, epoch)`
|
|
@@ -148,6 +150,8 @@ export type SelfhostedTurnSessionArgs = {
|
|
|
148
150
|
* the manifest), threaded so the SDK's per-turn provided-session env delta is
|
|
149
151
|
* empty. */
|
|
150
152
|
environment: Record<string, string>;
|
|
153
|
+
/** Attempt-local values projected only onto this machine's child execs. */
|
|
154
|
+
transientExecEnvironment?: () => Readonly<Record<string, string>>;
|
|
151
155
|
/** The session working directory (per-session pointer). Null ⇒ workspace_root. */
|
|
152
156
|
workingDir: string | null;
|
|
153
157
|
};
|