@opengeni/worker-bundle 1.0.0-canary.1 → 1.0.0
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 +3 -1
- package/dist/activities/agent-turn/admission.d.ts +24 -3
- package/dist/activities/agent-turn/agent-build.d.ts +4 -0
- package/dist/activities/agent-turn/claude-usage-observer.d.ts +58 -0
- package/dist/activities/agent-turn/code-search.d.ts +60 -0
- package/dist/activities/agent-turn/codex-capacity.d.ts +13 -0
- package/dist/activities/agent-turn/codex-plan-entitlement.d.ts +105 -0
- package/dist/activities/agent-turn/codex.d.ts +3 -2
- package/dist/activities/agent-turn/compaction-prep.d.ts +21 -5
- package/dist/activities/agent-turn/credential-leases.d.ts +19 -33
- package/dist/activities/agent-turn/credential-restriction.d.ts +3 -0
- package/dist/activities/agent-turn/errors.d.ts +82 -11
- package/dist/activities/agent-turn/failure-settlement.d.ts +6 -3
- package/dist/activities/agent-turn/final-reply.d.ts +18 -0
- package/dist/activities/agent-turn/finalization-monitor.d.ts +17 -0
- package/dist/activities/agent-turn/finalization.d.ts +4 -2
- package/dist/activities/agent-turn/github-repository-bindings.d.ts +2 -0
- package/dist/activities/agent-turn/governance-model.d.ts +9 -2
- package/dist/activities/agent-turn/history-sink.d.ts +2 -0
- package/dist/activities/agent-turn/history.d.ts +2 -0
- package/dist/activities/agent-turn/input-wait-reply.d.ts +41 -0
- package/dist/activities/agent-turn/media-artifacts.d.ts +5 -3
- package/dist/activities/agent-turn/model-call-admission.d.ts +15 -0
- package/dist/activities/agent-turn/model-usage.d.ts +6 -0
- package/dist/activities/agent-turn/model-wire-dispatch.d.ts +15 -0
- package/dist/activities/agent-turn/optional-repositories.d.ts +59 -0
- package/dist/activities/agent-turn/provider-dispatch-barrier.d.ts +12 -1
- package/dist/activities/agent-turn/quiescence.d.ts +7 -7
- package/dist/activities/agent-turn/recovery-warning.d.ts +9 -0
- package/dist/activities/agent-turn/refresh-credentials.d.ts +6 -0
- package/dist/activities/agent-turn/run-credentials.d.ts +8 -3
- package/dist/activities/agent-turn/sandbox-establish.d.ts +2 -1
- package/dist/activities/agent-turn/sandbox-provision.d.ts +3 -1
- package/dist/activities/agent-turn/sandbox-route.d.ts +3 -20
- package/dist/activities/agent-turn/sandbox-runtime.d.ts +2 -2
- package/dist/activities/agent-turn/session-title.d.ts +34 -2
- package/dist/activities/agent-turn/skill-checkout.d.ts +25 -6
- package/dist/activities/agent-turn/skill-read.d.ts +70 -2
- package/dist/activities/agent-turn/skill-remove.d.ts +14 -0
- package/dist/activities/agent-turn/skill-search.d.ts +3 -1
- package/dist/activities/agent-turn/skill-tools.d.ts +15 -2
- package/dist/activities/agent-turn/skill-transfer.d.ts +18 -6
- package/dist/activities/agent-turn/stream-attempt.d.ts +7 -3
- package/dist/activities/agent-turn/subscription-lease.d.ts +38 -0
- package/dist/activities/agent-turn/tool-environment.d.ts +56 -6
- package/dist/activities/agent-turn/tool-policy.d.ts +43 -0
- package/dist/activities/agent-turn/turn-context.d.ts +29 -0
- package/dist/activities/agent-turn/turn-sandbox-access.d.ts +3 -0
- package/dist/activities/agent-turn/xai-capacity.d.ts +2 -1
- package/dist/activities/automations.d.ts +3 -1
- package/dist/activities/browser-deadline-checkpoint.d.ts +29 -0
- package/dist/activities/codemode-dispatcher.d.ts +9 -2
- package/dist/activities/codex-capacity.d.ts +18 -2
- package/dist/activities/codex-rotation.d.ts +7 -1
- package/dist/activities/context-compaction.d.ts +16 -2
- package/dist/activities/gmail-files.d.ts +32 -0
- package/dist/activities/goals.d.ts +8 -0
- package/dist/activities/knowledge-indexing.d.ts +19 -0
- package/dist/activities/mcp-account-routes.d.ts +3 -0
- package/dist/activities/mcp-credentials.d.ts +12 -13
- package/dist/activities/mcp-operation-authority.d.ts +0 -5
- package/dist/activities/model-call-fact-reconciler.d.ts +34 -0
- package/dist/activities/open-suffix-resume.d.ts +13 -0
- package/dist/activities/parent-wake.d.ts +6 -12
- package/dist/activities/retained-screenshots.d.ts +7 -2
- package/dist/activities/rig-verification.d.ts +2 -3
- package/dist/activities/run-credential-renewal.d.ts +1 -0
- package/dist/activities/run-credentials.d.ts +15 -3
- package/dist/activities/sandbox-images.d.ts +1 -1
- package/dist/activities/sandbox-lease.d.ts +47 -9
- package/dist/activities/scheduled-tasks.d.ts +4 -35
- package/dist/activities/session-state.d.ts +70 -3
- package/dist/activities/types.d.ts +55 -6
- package/dist/activities/workspace-capture.d.ts +2 -0
- package/dist/activities/workspace-credential-provider.d.ts +46 -0
- package/dist/{activities-control-HMFGSKC5.js → activities-control-BNPTRTOE.js} +1896 -418
- package/dist/activities-control-BNPTRTOE.js.map +1 -0
- package/dist/activities-control.d.ts +182 -4
- package/dist/{activities-turn-AP67JADS.js → activities-turn-5LGZOSVU.js} +4476 -1327
- package/dist/activities-turn-5LGZOSVU.js.map +1 -0
- package/dist/activities.d.ts +182 -4
- package/dist/artifact-materializer-entry.js +5 -2
- package/dist/artifact-materializer-entry.js.map +1 -1
- package/dist/artifact-outbox-entry.js +5 -2
- package/dist/artifact-outbox-entry.js.map +1 -1
- package/dist/browser-deadline-checkpoint-contract.d.ts +2 -0
- package/dist/{chunk-A4XQWVZK.js → chunk-3ZTRWDMN.js} +307 -4
- package/dist/chunk-3ZTRWDMN.js.map +1 -0
- package/dist/{chunk-RAMNYSAW.js → chunk-4ER3YXOT.js} +22 -4
- package/dist/chunk-4ER3YXOT.js.map +1 -0
- package/dist/{chunk-CYITU5UH.js → chunk-LJX7Z2KP.js} +1445 -343
- package/dist/chunk-LJX7Z2KP.js.map +1 -0
- package/dist/editable-artifact-materializer-service.d.ts +2 -2
- package/dist/editable-artifact-outbox-service.d.ts +2 -2
- package/dist/host-export-pump.d.ts +3 -1
- package/dist/host-export.d.ts +1 -1
- package/dist/host-export.js +1 -1
- package/dist/http.d.ts +1 -1
- package/dist/index.d.ts +95 -3
- package/dist/index.js +137 -43
- package/dist/index.js.map +1 -1
- package/dist/observability-metrics.d.ts +118 -8
- package/dist/retained-process-diagnostics.d.ts +4 -0
- package/dist/retained-process-retry.d.ts +7 -0
- package/dist/sandbox-resume.d.ts +55 -13
- package/dist/sandbox-routing.d.ts +5 -3
- package/dist/sandbox-snapshot-diagnostics.d.ts +20 -0
- package/dist/session-event-fanout.d.ts +6 -0
- package/dist/warm-capture-holder.d.ts +3 -0
- package/dist/worker-service-lifecycle.d.ts +12 -0
- package/dist/workflow-bundle.js +273 -41
- package/dist/workflows/activities.d.ts +1 -1
- package/dist/workflows/browser-deadline-checkpoint.d.ts +9 -0
- package/dist/workflows/scheduled-tasks.d.ts +4 -0
- package/dist/workflows/session.d.ts +36 -0
- package/dist/workflows.d.ts +1 -0
- package/package.json +21 -19
- package/src/activities/agent-run-admission.ts +17 -1
- package/src/activities/agent-turn/admission.ts +66 -3
- package/src/activities/agent-turn/agent-build.ts +84 -10
- package/src/activities/agent-turn/claim.ts +186 -43
- package/src/activities/agent-turn/claude-usage-observer.ts +221 -0
- package/src/activities/agent-turn/code-search.ts +275 -0
- package/src/activities/agent-turn/codex-capacity.ts +172 -8
- package/src/activities/agent-turn/codex-plan-entitlement.ts +254 -0
- package/src/activities/agent-turn/codex.ts +13 -5
- package/src/activities/agent-turn/compaction-prep.ts +170 -102
- package/src/activities/agent-turn/credential-leases.ts +122 -216
- package/src/activities/agent-turn/credential-restriction.ts +14 -0
- package/src/activities/agent-turn/errors.ts +647 -48
- package/src/activities/agent-turn/failure-settlement.ts +682 -130
- package/src/activities/agent-turn/final-reply.ts +46 -0
- package/src/activities/agent-turn/finalization-monitor.ts +120 -0
- package/src/activities/agent-turn/finalization.ts +146 -43
- package/src/activities/agent-turn/github-repository-bindings.ts +3 -1
- package/src/activities/agent-turn/governance-model.ts +69 -28
- package/src/activities/agent-turn/history-sink.ts +16 -2
- package/src/activities/agent-turn/history.ts +38 -11
- package/src/activities/agent-turn/input-wait-reply.ts +103 -0
- package/src/activities/agent-turn/knowledge-source-tools.ts +2 -0
- package/src/activities/agent-turn/media-artifacts.ts +2 -1
- package/src/activities/agent-turn/model-call-admission.ts +94 -0
- package/src/activities/agent-turn/model-usage.ts +64 -3
- package/src/activities/agent-turn/model-wire-dispatch.ts +27 -0
- package/src/activities/agent-turn/optional-repositories.ts +224 -0
- package/src/activities/agent-turn/provider-dispatch-barrier.ts +22 -0
- package/src/activities/agent-turn/quiescence.ts +10 -7
- package/src/activities/agent-turn/recovery-warning.ts +16 -0
- package/src/activities/agent-turn/refresh-credentials.ts +44 -0
- package/src/activities/agent-turn/run-credentials.ts +116 -55
- package/src/activities/agent-turn/run.ts +320 -93
- package/src/activities/agent-turn/sandbox-establish.ts +84 -8
- package/src/activities/agent-turn/sandbox-provision.ts +3 -1
- package/src/activities/agent-turn/sandbox-route.ts +4 -21
- package/src/activities/agent-turn/sandbox-runtime.ts +343 -18
- package/src/activities/agent-turn/session-title.ts +81 -5
- package/src/activities/agent-turn/skill-checkout.ts +111 -24
- package/src/activities/agent-turn/skill-install.ts +1 -1
- package/src/activities/agent-turn/skill-read.ts +374 -28
- package/src/activities/agent-turn/skill-remove.ts +46 -0
- package/src/activities/agent-turn/skill-save.ts +1 -1
- package/src/activities/agent-turn/skill-search.ts +10 -1
- package/src/activities/agent-turn/skill-selection.ts +4 -0
- package/src/activities/agent-turn/skill-tools.ts +112 -18
- package/src/activities/agent-turn/skill-transfer.ts +68 -23
- package/src/activities/agent-turn/stream-attempt.ts +313 -77
- package/src/activities/agent-turn/subscription-lease.ts +115 -0
- package/src/activities/agent-turn/tool-environment.ts +316 -167
- package/src/activities/agent-turn/tool-policy.ts +80 -1
- package/src/activities/agent-turn/turn-context.ts +35 -0
- package/src/activities/agent-turn/turn-sandbox-access.ts +7 -1
- package/src/activities/agent-turn/xai-capacity.ts +94 -51
- package/src/activities/automations.ts +76 -4
- package/src/activities/browser-deadline-checkpoint.ts +279 -0
- package/src/activities/capabilities.ts +108 -11
- package/src/activities/codemode-dispatcher.ts +36 -8
- package/src/activities/codex-capacity.ts +60 -25
- package/src/activities/codex-rotation.ts +39 -17
- package/src/activities/context-compaction.ts +75 -18
- package/src/activities/gmail-files.ts +88 -0
- package/src/activities/goals.ts +116 -121
- package/src/activities/google-drive-publication.ts +1 -3
- package/src/activities/image-generation-operation.ts +1 -1
- package/src/activities/knowledge-indexing.ts +269 -15
- package/src/activities/knowledge-source-sync.ts +10 -0
- package/src/activities/mcp-account-routes.ts +17 -0
- package/src/activities/mcp-credentials.ts +83 -194
- package/src/activities/mcp-operation-authority.ts +16 -41
- package/src/activities/model-call-fact-reconciler.ts +112 -0
- package/src/activities/open-suffix-resume.ts +15 -2
- package/src/activities/parent-wake.ts +46 -21
- package/src/activities/retained-screenshots.ts +82 -11
- package/src/activities/rig-verification.ts +38 -37
- package/src/activities/run-credential-renewal.ts +13 -1
- package/src/activities/run-credentials.ts +59 -17
- package/src/activities/run-input.ts +25 -16
- package/src/activities/sandbox-images.ts +0 -1
- package/src/activities/sandbox-lease.ts +798 -82
- package/src/activities/scheduled-tasks.ts +550 -178
- package/src/activities/session-state.ts +245 -6
- package/src/activities/site-auth-maintenance.ts +3 -0
- package/src/activities/types.ts +72 -5
- package/src/activities/workflow-wake.ts +2 -17
- package/src/activities/workspace-capture.ts +13 -2
- package/src/activities/workspace-credential-provider.ts +283 -0
- package/src/activities-control.ts +4 -0
- package/src/activities-turn.ts +5 -0
- package/src/activities.ts +13 -0
- package/src/activity-services.ts +16 -4
- package/src/browser-deadline-checkpoint-contract.ts +5 -0
- package/src/editable-artifact-hint-broker.ts +3 -0
- package/src/editable-artifact-materializer-service.ts +7 -3
- package/src/editable-artifact-outbox-service.ts +4 -4
- package/src/github-rest-mcp.ts +1 -2
- package/src/host-export-pump.ts +26 -4
- package/src/host-export.ts +3 -0
- package/src/http.ts +4 -2
- package/src/index.ts +99 -37
- package/src/observability-metrics.ts +510 -5
- package/src/personal-github-git-credentials.ts +2 -1
- package/src/pr-review-credentials.ts +1 -3
- package/src/retained-process-diagnostics.ts +50 -0
- package/src/retained-process-retry.ts +36 -0
- package/src/sandbox-resume.ts +388 -101
- package/src/sandbox-routing.ts +150 -25
- package/src/sandbox-snapshot-diagnostics.ts +112 -0
- package/src/session-event-fanout.ts +23 -0
- package/src/warm-capture-holder.ts +15 -0
- package/src/worker-service-lifecycle.ts +53 -0
- package/src/workflows/activities.ts +16 -1
- package/src/workflows/browser-deadline-checkpoint.ts +50 -0
- package/src/workflows/file-upload-reaper.ts +2 -0
- package/src/workflows/scheduled-tasks.ts +26 -13
- package/src/workflows/session.ts +242 -22
- package/src/workflows.ts +4 -0
- package/dist/activities/agent-turn/knowledge-sources.d.ts +0 -20
- package/dist/activities/packs.d.ts +0 -55
- package/dist/activities-control-HMFGSKC5.js.map +0 -1
- package/dist/activities-turn-AP67JADS.js.map +0 -1
- package/dist/chunk-A4XQWVZK.js.map +0 -1
- package/dist/chunk-CYITU5UH.js.map +0 -1
- package/dist/chunk-RAMNYSAW.js.map +0 -1
- package/src/activities/agent-turn/knowledge-sources.ts +0 -86
- package/src/activities/packs.ts +0 -166
|
@@ -1,18 +1,31 @@
|
|
|
1
1
|
import type { AttemptToolDefinition } from "@opengeni/codemode";
|
|
2
|
-
import type
|
|
3
|
-
import {
|
|
2
|
+
import { type ModelCapabilitiesV1 } from "@opengeni/config";
|
|
3
|
+
import type { GeneratedSessionTitle, GenerateSessionTitleOptions, OpenGeniRuntime } from "@opengeni/runtime";
|
|
4
|
+
import { ReasoningEffort, type FirstPartyMcpToolName, type Permission, type ResolvedAgentConfig, type ToolRef } from "@opengeni/contracts";
|
|
4
5
|
export declare const SESSION_TITLE_MODEL_TOOL_NAME = "opengeni__set_session_title";
|
|
5
6
|
export declare function shouldRequestMissingSessionTitle(input: {
|
|
6
7
|
title: string | null;
|
|
7
8
|
titleSource: "user" | "agent" | null;
|
|
9
|
+
agentConfig?: ResolvedAgentConfig | null;
|
|
8
10
|
firstPartyMcpTools: readonly FirstPartyMcpToolName[];
|
|
9
11
|
firstPartyMcpPermissions: readonly Permission[] | null;
|
|
10
12
|
}): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Whether the turn's route can afford a model request spent only on a title.
|
|
15
|
+
* The managed OpenRouter free route draws on one deployment-wide per-minute
|
|
16
|
+
* and per-day request quota that users' turns need, so an untitled session on
|
|
17
|
+
* it gets no title sidecar and no title tool (whose call would cost a
|
|
18
|
+
* follow-up request). Clients keep showing the prompt preview, and a later
|
|
19
|
+
* turn on another route titles the session.
|
|
20
|
+
*/
|
|
21
|
+
export declare function routeAllowsSessionTitleRequests(resolvedModel: ReturnType<OpenGeniRuntime["resolveTurnModel"]>): boolean;
|
|
11
22
|
export declare function sessionTitleToolPlan(input: {
|
|
12
23
|
tools: readonly ToolRef[];
|
|
24
|
+
agentConfig?: ResolvedAgentConfig | null;
|
|
13
25
|
selectedFirstPartyMcpTools: readonly FirstPartyMcpToolName[];
|
|
14
26
|
shouldRequestTitle: boolean;
|
|
15
27
|
parallelGenerationAvailable: boolean;
|
|
28
|
+
routeAllowsTitleRequests: boolean;
|
|
16
29
|
}): {
|
|
17
30
|
promoteTitleTool: boolean;
|
|
18
31
|
generateTitleInParallel: boolean;
|
|
@@ -20,6 +33,25 @@ export declare function sessionTitleToolPlan(input: {
|
|
|
20
33
|
preparationIndependentToolNames: string[];
|
|
21
34
|
};
|
|
22
35
|
export declare const PARALLEL_SESSION_TITLE_TIMEOUT_MS = 15000;
|
|
36
|
+
/**
|
|
37
|
+
* The lowest reasoning effort the resolved model can run, for the auxiliary
|
|
38
|
+
* title request only. A title needs no deliberation, and a provider default
|
|
39
|
+
* effort can use most of the output budget before any visible text. Returns
|
|
40
|
+
* undefined when the model declares no runnable reasoning control, so the
|
|
41
|
+
* request carries no reasoning parameter.
|
|
42
|
+
*/
|
|
43
|
+
export declare function sessionTitleReasoningEffort(capabilities: Pick<ModelCapabilitiesV1, "reasoning"> | undefined): ReasoningEffort | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* Options for the parallel title request. It uses the turn's resolved
|
|
46
|
+
* provider and credential authority, but its own lowest runnable reasoning
|
|
47
|
+
* effort rather than the turn's effort.
|
|
48
|
+
*/
|
|
49
|
+
export declare function sessionTitleGenerationOptions(input: {
|
|
50
|
+
resolvedModel: ReturnType<OpenGeniRuntime["resolveTurnModel"]>;
|
|
51
|
+
modelName: string;
|
|
52
|
+
serviceTier: GenerateSessionTitleOptions["serviceTier"] | null | undefined;
|
|
53
|
+
signal: AbortSignal;
|
|
54
|
+
}): GenerateSessionTitleOptions;
|
|
23
55
|
export type ParallelSessionTitleGeneration = {
|
|
24
56
|
finish: () => Promise<GeneratedSessionTitle | null>;
|
|
25
57
|
cancel: () => Promise<void>;
|
|
@@ -1,8 +1,26 @@
|
|
|
1
1
|
import type { AttemptToolDefinition } from "@opengeni/codemode";
|
|
2
|
-
import type
|
|
3
|
-
import type
|
|
2
|
+
import { type SkillTextFile } from "@opengeni/runtime/skill-library";
|
|
3
|
+
import { type SkillFileSystem } from "./skill-transfer.js";
|
|
4
4
|
import type { SkillSaveReceipt, SkillSaveRequest } from "./skill-save.js";
|
|
5
|
-
type
|
|
5
|
+
export type SkillCheckoutOutcome = "written" | "unchanged" | "refused" | "failed";
|
|
6
|
+
/**
|
|
7
|
+
* Content-free timing of one skill_checkout call. `resolve` covers authority
|
|
8
|
+
* and the Skill read, `sandbox` acquiring the turn's filesystem handle, and
|
|
9
|
+
* `write` the batched filesystem write. On a lazily provisioned turn whose
|
|
10
|
+
* first sandbox use is this checkout, acquiring the handle starts the box, so
|
|
11
|
+
* box start is inside `sandbox`. A phase that did not run is null.
|
|
12
|
+
*/
|
|
13
|
+
export type SkillCheckoutObservation = Readonly<{
|
|
14
|
+
outcome: SkillCheckoutOutcome;
|
|
15
|
+
selection: "all" | "paths";
|
|
16
|
+
files: number;
|
|
17
|
+
written: number;
|
|
18
|
+
unchanged: number;
|
|
19
|
+
resolveSeconds: number | null;
|
|
20
|
+
sandboxSeconds: number | null;
|
|
21
|
+
writeSeconds: number | null;
|
|
22
|
+
totalSeconds: number;
|
|
23
|
+
}>;
|
|
6
24
|
export declare function createSkillCheckoutAttemptToolDefinition(input: {
|
|
7
25
|
authorize: () => Promise<void>;
|
|
8
26
|
load: (skill: string) => Promise<{
|
|
@@ -11,11 +29,12 @@ export declare function createSkillCheckoutAttemptToolDefinition(input: {
|
|
|
11
29
|
scopeVersion: number | null;
|
|
12
30
|
files: readonly SkillTextFile[];
|
|
13
31
|
}>;
|
|
14
|
-
filesystem: () => Promise<SkillFileSystem
|
|
32
|
+
filesystem: () => Promise<Pick<SkillFileSystem, "fsWriteFiles">>;
|
|
33
|
+
/** Telemetry only; a failure here never changes the result. */
|
|
34
|
+
observe?: (observation: SkillCheckoutObservation) => void;
|
|
15
35
|
}): AttemptToolDefinition;
|
|
16
36
|
export declare function createSkillPublishAttemptToolDefinition(input: {
|
|
17
37
|
authorize: () => Promise<void>;
|
|
18
|
-
filesystem: () => Promise<SkillFileSystem
|
|
38
|
+
filesystem: () => Promise<Pick<SkillFileSystem, "fsList" | "fsRead">>;
|
|
19
39
|
save: (request: SkillSaveRequest) => Promise<SkillSaveReceipt>;
|
|
20
40
|
}): AttemptToolDefinition;
|
|
21
|
-
export {};
|
|
@@ -1,15 +1,83 @@
|
|
|
1
|
-
import type { AttemptToolDefinition } from "@opengeni/codemode";
|
|
1
|
+
import type { AttemptToolDefinition, AttemptToolExecutionContext } from "@opengeni/codemode";
|
|
2
|
+
import { type SkillReadKind, type SkillUseSource } from "@opengeni/contracts";
|
|
2
3
|
import { type SkillTextFile } from "@opengeni/runtime/skill-library";
|
|
3
4
|
export declare const SKILL_READ_TOOL_NAME = "skill_read";
|
|
5
|
+
/** Content-free provenance of a resolved Skill. The caller never receives it. */
|
|
6
|
+
export type SkillReadOrigin = Readonly<{
|
|
7
|
+
id: string;
|
|
8
|
+
source: SkillUseSource;
|
|
9
|
+
/** Platform display label of a built-in; never user-authored text. */
|
|
10
|
+
label?: string;
|
|
11
|
+
/** Whole-artifact digest, for an artifact without a ledger revision. */
|
|
12
|
+
contentSha256?: string;
|
|
13
|
+
}>;
|
|
4
14
|
export type SkillReadContent = Readonly<{
|
|
5
15
|
files: readonly SkillTextFile[];
|
|
6
16
|
skillId: string;
|
|
7
17
|
revisionId: string;
|
|
8
18
|
scopeVersion: number;
|
|
9
19
|
installationVersion?: number;
|
|
20
|
+
origin?: SkillReadOrigin;
|
|
21
|
+
}>;
|
|
22
|
+
/** A selected built-in or session artifact: no ledger identity, and none is synthesized. */
|
|
23
|
+
export type SelectedSkillReadContent = Readonly<{
|
|
24
|
+
files: readonly SkillTextFile[];
|
|
25
|
+
origin: SkillReadOrigin;
|
|
26
|
+
}>;
|
|
27
|
+
export type SkillReadObservation = Readonly<{
|
|
28
|
+
caller: AttemptToolExecutionContext["caller"]["kind"];
|
|
29
|
+
kind: SkillReadKind;
|
|
30
|
+
/** Null when the read was refused before a Skill resolved. */
|
|
31
|
+
source: SkillUseSource | null;
|
|
32
|
+
/** The resolved Skill id, or the requested identifier when none resolved. */
|
|
33
|
+
skill: string;
|
|
34
|
+
}>;
|
|
35
|
+
/**
|
|
36
|
+
* Content-free read telemetry. It never changes what the caller receives: a
|
|
37
|
+
* model result gains only MCP `_meta`, which the model never sees and which
|
|
38
|
+
* only the tool-output event projection keeps.
|
|
39
|
+
*/
|
|
40
|
+
export type SkillReadTelemetry = Readonly<{
|
|
41
|
+
/** Ids in the Skill index the model sees this turn; null until known. */
|
|
42
|
+
indexedSkillIds: () => ReadonlySet<string> | null;
|
|
43
|
+
/** Whether skill_search returned this id earlier in this turn attempt. */
|
|
44
|
+
searched: (id: string) => boolean;
|
|
45
|
+
observe: (observation: SkillReadObservation) => void;
|
|
46
|
+
}>;
|
|
47
|
+
export type SkillReadActiveHistory = Readonly<{
|
|
48
|
+
/** Earlier skill_read results still in this session's active model history. */
|
|
49
|
+
readResults: () => Promise<ReadonlyArray<Record<string, unknown>>>;
|
|
50
|
+
/**
|
|
51
|
+
* This turn's model tool-output bound. Rows are bounded when stored, but a
|
|
52
|
+
* later model with a lower bound receives a shorter copy than the row holds.
|
|
53
|
+
*/
|
|
54
|
+
toolOutputTruncationTokens: () => number;
|
|
55
|
+
/** The lookup only saves tokens, so a failure returns the full text. */
|
|
56
|
+
onLookupFailed?: (error: unknown) => void;
|
|
57
|
+
}>;
|
|
58
|
+
export declare const SKILL_UNAVAILABLE_MESSAGE = "Skill is not available in this session.";
|
|
59
|
+
/** Bounds on the Skill list an unresolved identifier returns. */
|
|
60
|
+
export declare const SKILL_UNAVAILABLE_LIST_MAX_ENTRIES = 25;
|
|
61
|
+
export declare const SKILL_UNAVAILABLE_LIST_MAX_BYTES: number;
|
|
62
|
+
export type AvailableSkill = Readonly<{
|
|
63
|
+
id: string;
|
|
64
|
+
name: string;
|
|
10
65
|
}>;
|
|
66
|
+
/**
|
|
67
|
+
* The error for an identifier that resolves to no Skill. It lists available
|
|
68
|
+
* Skills by id and name only, the descriptors the Skill index and skill_search
|
|
69
|
+
* already show the model, so the caller can retry instead of rediscovering
|
|
70
|
+
* the work from scratch. Entries resembling the requested identifier (shared
|
|
71
|
+
* prefix, suffix, or containment) come first, so a mistyped or spliced id
|
|
72
|
+
* keeps its likely targets inside the bound. The requested identifier is
|
|
73
|
+
* never echoed.
|
|
74
|
+
*/
|
|
75
|
+
export declare function unavailableSkillError(requested: string, available: readonly AvailableSkill[]): Error;
|
|
11
76
|
/** A first-party gateway definition, not a sandbox capability or second backend. */
|
|
12
77
|
export declare function createSkillReadAttemptToolDefinition(input: {
|
|
13
78
|
authorize: () => Promise<void>;
|
|
14
|
-
load: (skill: string) => Promise<readonly SkillTextFile[] | SkillReadContent>;
|
|
79
|
+
load: (skill: string) => Promise<readonly SkillTextFile[] | SkillReadContent | SelectedSkillReadContent>;
|
|
80
|
+
/** Without it every read returns full text. */
|
|
81
|
+
activeHistory?: SkillReadActiveHistory;
|
|
82
|
+
telemetry?: SkillReadTelemetry;
|
|
15
83
|
}): AttemptToolDefinition;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { AttemptToolDefinition } from "@opengeni/codemode";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import type { SkillWriteReceipt } from "@opengeni/contracts";
|
|
4
|
+
export declare const SkillRemoveRequest: z.ZodObject<{
|
|
5
|
+
operationId: z.ZodUUID;
|
|
6
|
+
skillId: z.ZodUUID;
|
|
7
|
+
expectedRevisionId: z.ZodNullable<z.ZodUUID>;
|
|
8
|
+
expectedScopeVersion: z.ZodNumber;
|
|
9
|
+
reason: z.ZodString;
|
|
10
|
+
}, z.core.$strict>;
|
|
11
|
+
export declare function createSkillRemoveAttemptToolDefinition(input: {
|
|
12
|
+
authorize: () => Promise<void>;
|
|
13
|
+
remove: (request: z.infer<typeof SkillRemoveRequest>) => Promise<SkillWriteReceipt>;
|
|
14
|
+
}): AttemptToolDefinition;
|
|
@@ -7,10 +7,12 @@ export type WorkspaceSkillSearchEntry = Readonly<{
|
|
|
7
7
|
revisionId?: string;
|
|
8
8
|
scopeVersion?: number;
|
|
9
9
|
installationVersion?: number;
|
|
10
|
-
source?: "workspace" | "builtin" | "session"
|
|
10
|
+
source?: "workspace" | "builtin" | "session";
|
|
11
11
|
}>;
|
|
12
12
|
export declare function createSkillSearchAttemptToolDefinition(input: {
|
|
13
13
|
authorize: () => Promise<void>;
|
|
14
14
|
listWorkspace: () => Promise<readonly WorkspaceSkillSearchEntry[]>;
|
|
15
15
|
publicSearch: PublicSkillSearchClient;
|
|
16
|
+
/** Ids of the readable Skills a search returned, for read telemetry only. */
|
|
17
|
+
onWorkspaceHits?: (ids: readonly string[]) => void;
|
|
16
18
|
}): AttemptToolDefinition;
|
|
@@ -2,7 +2,9 @@ import type { Settings } from "@opengeni/config";
|
|
|
2
2
|
import { type SkillActor } from "@opengeni/contracts";
|
|
3
3
|
import { type Database } from "@opengeni/db";
|
|
4
4
|
import type { RuntimeSkillArtifact } from "@opengeni/runtime";
|
|
5
|
-
import type
|
|
5
|
+
import { type SkillReadObservation } from "./skill-read.js";
|
|
6
|
+
import { type SkillCheckoutObservation } from "./skill-checkout.js";
|
|
7
|
+
import type { SkillFileSystem } from "./skill-transfer.js";
|
|
6
8
|
export declare function createWorkspaceSkillTools(input: {
|
|
7
9
|
db: Database;
|
|
8
10
|
settings: Settings;
|
|
@@ -16,5 +18,16 @@ export declare function createWorkspaceSkillTools(input: {
|
|
|
16
18
|
id: string;
|
|
17
19
|
artifact: RuntimeSkillArtifact;
|
|
18
20
|
}[];
|
|
19
|
-
filesystem: () => Promise<
|
|
21
|
+
filesystem: () => Promise<SkillFileSystem>;
|
|
22
|
+
/** Content-free skill_checkout timing; it never changes a result. */
|
|
23
|
+
observeSkillCheckout?: (observation: SkillCheckoutObservation) => void;
|
|
24
|
+
/** The resolved model's bound, which `settings` does not carry. */
|
|
25
|
+
modelToolOutputTruncationTokens: () => number;
|
|
26
|
+
onSkillReadHistoryLookupFailed?: (error: unknown) => void;
|
|
27
|
+
/** Content-free skill_read telemetry; it never changes a result. */
|
|
28
|
+
skillReadTelemetry?: {
|
|
29
|
+
/** Ids in the Skill index the model sees this turn; null until known. */
|
|
30
|
+
indexedSkillIds: () => ReadonlySet<string> | null;
|
|
31
|
+
observe: (observation: SkillReadObservation) => void;
|
|
32
|
+
};
|
|
20
33
|
}): import("@opengeni/codemode").AttemptToolDefinition[];
|
|
@@ -1,26 +1,38 @@
|
|
|
1
1
|
import type { SandboxChannelAService } from "@opengeni/runtime/sandbox";
|
|
2
2
|
import { type SkillTextFile } from "@opengeni/runtime/skill-library";
|
|
3
|
-
type SkillFileSystem = Pick<SandboxChannelAService, "fsList" | "fsRead" | "
|
|
3
|
+
export type SkillFileSystem = Pick<SandboxChannelAService, "fsList" | "fsRead" | "fsWriteFiles">;
|
|
4
4
|
/** Reuse the host's cancellation and workspace-mutation authority for each filesystem operation. */
|
|
5
5
|
export declare function guardSkillFilesystem(fs: SkillFileSystem, authority: {
|
|
6
6
|
assertActive: () => void;
|
|
7
7
|
runMutation: <T>(operation: () => Promise<T>) => Promise<T>;
|
|
8
8
|
}): SkillFileSystem;
|
|
9
|
-
|
|
10
|
-
export declare function checkoutSkillDirectory(fs: SkillFileSystem, directory: string, files: readonly SkillTextFile[]): Promise<{
|
|
9
|
+
export type SkillCheckoutResult = {
|
|
11
10
|
directory: string;
|
|
12
11
|
fileCount: number;
|
|
13
|
-
|
|
12
|
+
written: number;
|
|
13
|
+
unchanged: number;
|
|
14
|
+
/** This call created the directory, so it holds nothing but these files. */
|
|
15
|
+
createdDirectory: boolean;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Caller supplies an authorized live filesystem and a workspace-relative
|
|
19
|
+
* target. All missing files are created in one filesystem batch (normally a
|
|
20
|
+
* single sandbox command). Nothing is overwritten: files already holding the
|
|
21
|
+
* same bytes are kept, and any other existing entry fails before writing.
|
|
22
|
+
* `paths` selects exactly those Skill files, for example one script to run.
|
|
23
|
+
*/
|
|
24
|
+
export declare function checkoutSkillDirectory(fs: Pick<SkillFileSystem, "fsWriteFiles">, directory: string, files: readonly SkillTextFile[], options?: {
|
|
25
|
+
paths?: readonly string[];
|
|
26
|
+
}): Promise<SkillCheckoutResult>;
|
|
14
27
|
/**
|
|
15
28
|
* Read a folder through existing structured filesystem services, never via model
|
|
16
29
|
* arguments. The caller owns workspace confinement and the final governed save.
|
|
17
30
|
* This operation does not execute scripts or activate the resulting artifact.
|
|
18
31
|
*/
|
|
19
|
-
export declare function readSkillDirectory(fs: SkillFileSystem, directory: string): Promise<Readonly<{
|
|
32
|
+
export declare function readSkillDirectory(fs: Pick<SkillFileSystem, "fsList" | "fsRead">, directory: string): Promise<Readonly<{
|
|
20
33
|
name: string;
|
|
21
34
|
description: string;
|
|
22
35
|
files: readonly import("@opengeni/runtime").SkillLibraryFile[];
|
|
23
36
|
contentSha256: string;
|
|
24
37
|
totalBytes: number;
|
|
25
38
|
}>>;
|
|
26
|
-
export {};
|
|
@@ -11,7 +11,7 @@ import { ToolResultSpill } from "./tool-result-spill.js";
|
|
|
11
11
|
import { createTurnCredentialLeases } from "./credential-leases.js";
|
|
12
12
|
import { createTurnMediaArtifacts } from "./media-artifacts.js";
|
|
13
13
|
import { createTurnHistorySink } from "./history-sink.js";
|
|
14
|
-
import { type SessionEvent } from "@opengeni/contracts";
|
|
14
|
+
import { type SessionEvent, type SessionTurn } from "@opengeni/contracts";
|
|
15
15
|
import { createModelCheckpointMemoryCollector } from "../../model-checkpoint-memory-collector.js";
|
|
16
16
|
import { TurnEventPublisher } from "./model-usage.js";
|
|
17
17
|
import type { CompactionSummarizer } from "../context-compaction.js";
|
|
@@ -44,11 +44,12 @@ export type TurnStreamAttemptDeps = {
|
|
|
44
44
|
providerTurn: ProviderTurnState;
|
|
45
45
|
leases: ReturnType<typeof createTurnCredentialLeases>;
|
|
46
46
|
historySink: ReturnType<typeof createTurnHistorySink>;
|
|
47
|
+
checkpointBeforeProviderDispatch: () => Promise<void>;
|
|
47
48
|
media: ReturnType<typeof createTurnMediaArtifacts>;
|
|
48
49
|
toolResultSpill: ToolResultSpill;
|
|
49
50
|
claimedResult: ClaimedResult;
|
|
50
51
|
flushRuntimeBatcher: () => Promise<void>;
|
|
51
|
-
finalizeTurnOpStreamOps: () => Promise<void>;
|
|
52
|
+
finalizeTurnOpStreamOps: (toolCallIds?: readonly string[]) => Promise<void>;
|
|
52
53
|
runWorkspaceMutationForSandbox: <T>(sandbox: ResumedTurnSandbox, operation: string, mutation: () => Promise<T>, observePhase?: (measurement: {
|
|
53
54
|
phase: "admission" | "provider" | "settlement" | "snapshot_wait";
|
|
54
55
|
outcome: "completed" | "failed";
|
|
@@ -79,9 +80,12 @@ export type TurnStreamAttemptDeps = {
|
|
|
79
80
|
activeSandboxBackend: Settings["sandboxBackend"] | undefined;
|
|
80
81
|
groupBoxBackend: Settings["sandboxBackend"];
|
|
81
82
|
turnExecutionPolicy: TurnExecutionPolicyV1;
|
|
82
|
-
turn: {
|
|
83
|
+
turn: Pick<SessionTurn, "initiator" | "initiatorContext"> & {
|
|
84
|
+
initiatingHumanSubjectId: string | null;
|
|
85
|
+
id: string;
|
|
83
86
|
executionGeneration: number;
|
|
84
87
|
model: string;
|
|
88
|
+
source?: string;
|
|
85
89
|
};
|
|
86
90
|
trigger: NonNullable<Awaited<ReturnType<typeof getSessionEvent>>>;
|
|
87
91
|
humanInputResume: Awaited<ReturnType<typeof getHumanInputResumeForEvent>>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export type LeaseRenewReason = "timer" | "runtime_event" | "model_usage";
|
|
2
|
+
export type LeaseLossReason = "deadline" | "not_found";
|
|
3
|
+
type LeaseIdentity = {
|
|
4
|
+
turnId: string;
|
|
5
|
+
holderId: string;
|
|
6
|
+
generation: number;
|
|
7
|
+
};
|
|
8
|
+
export type SubscriptionLeaseDeps = {
|
|
9
|
+
ttlMs: number;
|
|
10
|
+
getTurnId: () => string | undefined;
|
|
11
|
+
heartbeat: (identity: LeaseIdentity) => Promise<Date | null>;
|
|
12
|
+
onLost: (reason: LeaseLossReason) => void;
|
|
13
|
+
onRenewed?: (reason: LeaseRenewReason) => void;
|
|
14
|
+
onError: (error: unknown, reason: LeaseRenewReason) => void;
|
|
15
|
+
lostError: (reason: LeaseLossReason) => Error;
|
|
16
|
+
now?: () => number;
|
|
17
|
+
};
|
|
18
|
+
/** Cross-provider lease lifecycle. Only on-time DB confirmation extends ownership. */
|
|
19
|
+
export declare class SubscriptionTurnLease {
|
|
20
|
+
private readonly leaseDeps;
|
|
21
|
+
held: boolean;
|
|
22
|
+
lost: boolean;
|
|
23
|
+
lossReason: LeaseLossReason | null;
|
|
24
|
+
holderId: string | null;
|
|
25
|
+
generation: number | null;
|
|
26
|
+
confirmedUntilMs: number | null;
|
|
27
|
+
private heartbeatInFlight;
|
|
28
|
+
private heartbeatTimer;
|
|
29
|
+
private readonly now;
|
|
30
|
+
constructor(leaseDeps: SubscriptionLeaseDeps);
|
|
31
|
+
private expired;
|
|
32
|
+
markLost: (reason: LeaseLossReason) => void;
|
|
33
|
+
assertUsable: () => void;
|
|
34
|
+
renew: (reason?: LeaseRenewReason) => Promise<void>;
|
|
35
|
+
startHeartbeat: () => void;
|
|
36
|
+
stopHeartbeat: () => void;
|
|
37
|
+
}
|
|
38
|
+
export {};
|
|
@@ -1,15 +1,20 @@
|
|
|
1
|
-
import { type AttemptConnectorActionBinding, type ConnectorActionPolicyHooks } from "@opengeni/runtime";
|
|
1
|
+
import { type RunMcpCredentials, type AttemptConnectorActionBinding, type ConnectorActionPolicyHooks } from "@opengeni/runtime";
|
|
2
2
|
import { type Settings } from "@opengeni/config";
|
|
3
3
|
import { withFirstPartyTools } from "../goals.js";
|
|
4
4
|
import type { TurnActivityServices as ActivityServices, RunAgentTurnInput } from "../types.js";
|
|
5
5
|
import { ToolResultSpill } from "./tool-result-spill.js";
|
|
6
6
|
import { createTurnMediaArtifacts } from "./media-artifacts.js";
|
|
7
|
+
import { type ResourceRef, type Permission } from "@opengeni/contracts";
|
|
7
8
|
import type { ClaimTurnOk } from "./claim.js";
|
|
8
9
|
import type { GovernanceModelOk } from "./governance-model.js";
|
|
9
10
|
import type { SandboxTurnRuntime } from "./sandbox-runtime.js";
|
|
10
11
|
import type { sandboxArtifactRuntimeAdmission } from "./sandbox-route.js";
|
|
11
|
-
import type { AttemptIdentityState, EventingState, SandboxRuntimeState, WorkspaceRefState } from "./turn-context.js";
|
|
12
|
-
|
|
12
|
+
import type { AttemptIdentityState, EventingState, RenewalState, SandboxRuntimeState, WorkspaceRefState } from "./turn-context.js";
|
|
13
|
+
/** A linked turn's immutable policy must survive array and token boundaries. */
|
|
14
|
+
export declare function linkedTurnFirstPartyPermissions(selected: Permission[] | null, linked: {
|
|
15
|
+
permissions: Permission[];
|
|
16
|
+
permissionMode?: "legacy" | "explicit";
|
|
17
|
+
} | null): Permission[] | null;
|
|
13
18
|
export type PrepareTurnToolPolicyDeps = {
|
|
14
19
|
input: RunAgentTurnInput;
|
|
15
20
|
db: ActivityServices["db"];
|
|
@@ -25,7 +30,6 @@ export type PrepareTurnToolPolicyDeps = {
|
|
|
25
30
|
};
|
|
26
31
|
export type PrepareTurnToolRuntimeDeps = {
|
|
27
32
|
fetchKnowledgeSource?: ((input: import("../types.js").RunKnowledgeSourceSyncBatchInput) => Promise<import("../types.js").RunKnowledgeSourceSyncBatchResult>) | undefined;
|
|
28
|
-
selectedSkillActivations: readonly RuntimeSkillActivation[];
|
|
29
33
|
input: RunAgentTurnInput;
|
|
30
34
|
catalogSourceSettings: Settings;
|
|
31
35
|
db: ActivityServices["db"];
|
|
@@ -34,7 +38,6 @@ export type PrepareTurnToolRuntimeDeps = {
|
|
|
34
38
|
objectStorage: ActivityServices["objectStorage"];
|
|
35
39
|
observability: ActivityServices["observability"];
|
|
36
40
|
cancellationSignal: AbortSignal | undefined;
|
|
37
|
-
connectionCredentials: ActivityServices["connectionCredentials"];
|
|
38
41
|
eventing: EventingState;
|
|
39
42
|
attempt: AttemptIdentityState;
|
|
40
43
|
sandboxState: SandboxRuntimeState;
|
|
@@ -49,13 +52,13 @@ export type PrepareTurnToolRuntimeDeps = {
|
|
|
49
52
|
turnExecutionPolicy: ClaimTurnOk["turnExecutionPolicy"];
|
|
50
53
|
trigger: ClaimTurnOk["trigger"];
|
|
51
54
|
runSettings: GovernanceModelOk["runSettings"];
|
|
55
|
+
resolvedModel: GovernanceModelOk["resolvedModel"];
|
|
52
56
|
lazyToolTransport: GovernanceModelOk["lazyToolTransport"];
|
|
53
57
|
turnTools: ReturnType<typeof withFirstPartyTools>;
|
|
54
58
|
connectionScope: {
|
|
55
59
|
accountId: string;
|
|
56
60
|
workspaceId: string;
|
|
57
61
|
};
|
|
58
|
-
hostCredentialRootSessionId: string | null;
|
|
59
62
|
sandboxArtifactRuntime: ReturnType<typeof sandboxArtifactRuntimeAdmission>;
|
|
60
63
|
activeSandboxBackend: Settings["sandboxBackend"] | undefined;
|
|
61
64
|
groupBoxBackend: Settings["sandboxBackend"];
|
|
@@ -64,8 +67,18 @@ export type PrepareTurnToolRuntimeDeps = {
|
|
|
64
67
|
credentialSubjectId: ClaimTurnOk["credentialSubjectId"];
|
|
65
68
|
interactionInterventionResume: ClaimTurnOk["interactionInterventionResume"];
|
|
66
69
|
runWorkspaceMutationForSandbox: SandboxTurnRuntime["runWorkspaceMutationForSandbox"];
|
|
70
|
+
/** Deployment and workspace allow the Jev-backed code_search tool. */
|
|
71
|
+
codeSearchEnabled: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* False for an optional repository that sits this turn out after losing
|
|
74
|
+
* access (dropUnavailableOptionalRepositories), so no tool surface offers it.
|
|
75
|
+
*/
|
|
76
|
+
retainsOptionalRepository?: (resource: ResourceRef) => boolean;
|
|
67
77
|
throwIfWorkerShuttingDown: () => void;
|
|
68
78
|
throwIfTurnCancelled: () => void;
|
|
79
|
+
/** Present when this turn resolves host-managed run credentials. */
|
|
80
|
+
runCredentialRenewals?: RenewalState | undefined;
|
|
81
|
+
runMcpCredentials?: RunMcpCredentials;
|
|
69
82
|
};
|
|
70
83
|
export declare function prepareTurnToolPolicy(deps: PrepareTurnToolPolicyDeps): Promise<{
|
|
71
84
|
turnResources: ({
|
|
@@ -85,6 +98,7 @@ export declare function prepareTurnToolPolicy(deps: PrepareTurnToolPolicyDeps):
|
|
|
85
98
|
connectionId?: string | undefined;
|
|
86
99
|
githubInstallationId?: number | undefined;
|
|
87
100
|
githubRepositoryId?: number | undefined;
|
|
101
|
+
optional?: boolean | undefined;
|
|
88
102
|
} | {
|
|
89
103
|
kind: "file";
|
|
90
104
|
fileId: string;
|
|
@@ -107,6 +121,7 @@ export declare function prepareTurnToolPolicy(deps: PrepareTurnToolPolicyDeps):
|
|
|
107
121
|
connectionId?: string | undefined;
|
|
108
122
|
githubInstallationId?: number | undefined;
|
|
109
123
|
githubRepositoryId?: number | undefined;
|
|
124
|
+
optional?: boolean | undefined;
|
|
110
125
|
} | {
|
|
111
126
|
kind: "file";
|
|
112
127
|
fileId: string;
|
|
@@ -129,9 +144,44 @@ export declare function prepareTurnToolPolicy(deps: PrepareTurnToolPolicyDeps):
|
|
|
129
144
|
export declare function prepareTurnToolRuntime(deps: PrepareTurnToolRuntimeDeps): Promise<{
|
|
130
145
|
attemptConnectorActionBindings: AttemptConnectorActionBinding[];
|
|
131
146
|
connectorActionPolicy: ConnectorActionPolicyHooks;
|
|
147
|
+
mcpServers: {
|
|
148
|
+
id: string;
|
|
149
|
+
name?: string | undefined;
|
|
150
|
+
url: string;
|
|
151
|
+
allowedTools?: string[] | undefined;
|
|
152
|
+
timeoutMs?: number | undefined;
|
|
153
|
+
cacheToolsList: boolean;
|
|
154
|
+
requireApproval?: boolean | string[] | undefined;
|
|
155
|
+
headers?: Record<string, string> | undefined;
|
|
156
|
+
connectionRef?: {
|
|
157
|
+
connectionId?: string | undefined;
|
|
158
|
+
accountSelection?: "all_eligible" | undefined;
|
|
159
|
+
authoritySource?: "host" | undefined;
|
|
160
|
+
hostBinding?: {
|
|
161
|
+
bindingId: string;
|
|
162
|
+
generation: number;
|
|
163
|
+
} | {
|
|
164
|
+
selection: "accepted_turn";
|
|
165
|
+
} | undefined;
|
|
166
|
+
provider?: string | undefined;
|
|
167
|
+
providerDomain: string;
|
|
168
|
+
kind?: "api_key" | "app_install" | "delegated" | "oauth2" | undefined;
|
|
169
|
+
scopes?: string[] | undefined;
|
|
170
|
+
resource?: string | undefined;
|
|
171
|
+
selectedResources?: {
|
|
172
|
+
id: string;
|
|
173
|
+
kind: "repository";
|
|
174
|
+
}[] | undefined;
|
|
175
|
+
subjectScope?: "subject" | "workspace" | undefined;
|
|
176
|
+
} | undefined;
|
|
177
|
+
operationRecovery?: Record<string, {
|
|
178
|
+
observerTool: string;
|
|
179
|
+
}> | undefined;
|
|
180
|
+
}[];
|
|
132
181
|
generateSessionTitleInParallel: boolean;
|
|
133
182
|
postToolPreparationStartedAt: number;
|
|
134
183
|
preparationIndependentToolNames: string[];
|
|
184
|
+
codeSearchAvailable: boolean;
|
|
135
185
|
skillCatalog: {
|
|
136
186
|
id: string;
|
|
137
187
|
name: string;
|
|
@@ -43,6 +43,49 @@ export declare function structuredToolTransportForTurn(resolvedModel: {
|
|
|
43
43
|
baseUrl?: string | undefined;
|
|
44
44
|
};
|
|
45
45
|
} | null): boolean;
|
|
46
|
+
/**
|
|
47
|
+
* `text.verbosity: "low"` is the Codex CLI default for its GPT-5-family models
|
|
48
|
+
* and keeps final answers short. Send it only where the wire is known to accept
|
|
49
|
+
* it: the ChatGPT/Codex subscription backend, direct OpenAI Responses, and the
|
|
50
|
+
* Azure OpenAI Responses wire, where the parallel session-title request already
|
|
51
|
+
* sends the same field with the turn's model. Gateways, xAI, other
|
|
52
|
+
* OpenAI-compatible endpoints and chat wires keep their provider default. The
|
|
53
|
+
* result depends only on the route and model, so a session sends the same value
|
|
54
|
+
* on every request until its model changes, and a model change already starts a
|
|
55
|
+
* new prompt-cache prefix.
|
|
56
|
+
*/
|
|
57
|
+
export declare function textVerbosityForTurn(resolvedModel: {
|
|
58
|
+
provider: {
|
|
59
|
+
id: string;
|
|
60
|
+
kind: ResolvedModelProvider["kind"];
|
|
61
|
+
api: ModelProviderApi;
|
|
62
|
+
wireProfile: "openai" | "azure-openai";
|
|
63
|
+
builtin: boolean;
|
|
64
|
+
baseUrl?: string | undefined;
|
|
65
|
+
};
|
|
66
|
+
} | null, upstreamModelId: string): "low" | undefined;
|
|
67
|
+
/**
|
|
68
|
+
* Ask supported reasoning Responses routes for their provider-selected summary
|
|
69
|
+
* format. This is public summary text, never private or encrypted reasoning.
|
|
70
|
+
* Codex and unverified compatible wires retain the existing detailed setting.
|
|
71
|
+
*/
|
|
72
|
+
export declare function reasoningSummaryForTurn(resolvedModel: {
|
|
73
|
+
provider: {
|
|
74
|
+
id: string;
|
|
75
|
+
api: ModelProviderApi;
|
|
76
|
+
wireProfile: "openai" | "azure-openai";
|
|
77
|
+
builtin: boolean;
|
|
78
|
+
baseUrl?: string | undefined;
|
|
79
|
+
};
|
|
80
|
+
configured: {
|
|
81
|
+
upstreamModelId: string;
|
|
82
|
+
capabilities: {
|
|
83
|
+
reasoning: {
|
|
84
|
+
runnable: boolean;
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
} | null): "auto" | undefined;
|
|
46
89
|
/**
|
|
47
90
|
* Progressive tool disclosure is universal for supported OpenGeni turns; only
|
|
48
91
|
* its contained transport differs. Codex keeps its native path, built-in direct
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { TurnHeartbeatDetails } from "../../op-journal.js";
|
|
1
2
|
import type { Settings } from "@opengeni/config";
|
|
2
3
|
import type { CodexUsageHeaderSnapshot } from "@opengeni/codex";
|
|
3
4
|
import type { AppendEventInput, ApplySessionTurnSettlementInput } from "@opengeni/db";
|
|
@@ -14,6 +15,7 @@ import type { TurnOutcome } from "../../observability-metrics.js";
|
|
|
14
15
|
import type { ResumedTurnSandbox, TurnSandboxLeaseHolderId } from "../../sandbox-resume.js";
|
|
15
16
|
import type { TurnEventPublisher } from "./model-usage.js";
|
|
16
17
|
import type { TurnSandboxProvisioner } from "./sandbox-provision.js";
|
|
18
|
+
import { InitialModelWireDispatchClock } from "./model-wire-dispatch.js";
|
|
17
19
|
/** Stamps the claimed turn/attempt ids onto a phase's own outcome. */
|
|
18
20
|
export type ClaimedResult = (result: Omit<Extract<RunAgentTurnResult, {
|
|
19
21
|
status: Exclude<RunAgentTurnResult["status"], "unclaimed">;
|
|
@@ -24,6 +26,7 @@ export type TurnSettleFn = (input: {
|
|
|
24
26
|
sessionStatus: SessionStatus;
|
|
25
27
|
activeTurnId: string | null;
|
|
26
28
|
suppressGoalContinuation?: boolean;
|
|
29
|
+
allowanceGoalPause?: ApplySessionTurnSettlementInput["allowanceGoalPause"];
|
|
27
30
|
consumeRequestedCompactionFailure?: boolean;
|
|
28
31
|
runState?: ApplySessionTurnSettlementInput["runState"];
|
|
29
32
|
}) => Promise<boolean>;
|
|
@@ -40,6 +43,10 @@ export type AttemptIdentityState = {
|
|
|
40
43
|
triggerEventId: string | undefined;
|
|
41
44
|
executionGeneration: number;
|
|
42
45
|
providerRecoveryCount: number;
|
|
46
|
+
claudeAuthRecovery?: {
|
|
47
|
+
credentialId: string;
|
|
48
|
+
credentialVersion: number;
|
|
49
|
+
} | undefined;
|
|
43
50
|
modelRequestStarted: boolean;
|
|
44
51
|
redispatchesAtDispatch: number;
|
|
45
52
|
triggerType: string | null;
|
|
@@ -47,6 +54,7 @@ export type AttemptIdentityState = {
|
|
|
47
54
|
export type BillingState = {
|
|
48
55
|
isCodexTurn: boolean;
|
|
49
56
|
isXaiTurn: boolean;
|
|
57
|
+
isClaudeTurn: boolean;
|
|
50
58
|
isExternallyBilledTurn: boolean;
|
|
51
59
|
chargesOpenGeniCredits: boolean;
|
|
52
60
|
countsTowardTokenCap: boolean;
|
|
@@ -79,16 +87,23 @@ export type SandboxRuntimeState = {
|
|
|
79
87
|
startupMilestoneBackend: Settings["sandboxBackend"] | null;
|
|
80
88
|
};
|
|
81
89
|
export type RenewalState = {
|
|
90
|
+
/** Secret-only local state; closed on every attempt finalization path. */
|
|
91
|
+
runMcpCredentials?: {
|
|
92
|
+
close(): void;
|
|
93
|
+
};
|
|
82
94
|
gitCredentialRenewals: GitCredentialRenewalController[];
|
|
83
95
|
gitCredentialRenewalClosed: boolean;
|
|
84
96
|
runCredentialRenewal: RunCredentialRenewalController | null;
|
|
85
97
|
runCredentialRenewalClosed: boolean;
|
|
98
|
+
/** Outcome of the most recent renewal attempt, for on-demand refresh reporting. */
|
|
99
|
+
runCredentialRenewalOutcome: "completed" | "auth_needed" | "error" | null;
|
|
86
100
|
runCredentialSession: RunCredentialCommandSession | null;
|
|
87
101
|
codemodeTokenRenewal: CodemodeTokenRenewalController | null;
|
|
88
102
|
codemodeTokenRenewalClosed: boolean;
|
|
89
103
|
publishedRunCredentialNotices: Set<string>;
|
|
90
104
|
};
|
|
91
105
|
export type EventingState = {
|
|
106
|
+
heartbeatDetails: TurnHeartbeatDetails | null;
|
|
92
107
|
heartbeatTimer: ReturnType<typeof startActivityHeartbeat> | undefined;
|
|
93
108
|
batcher: ReturnType<typeof createRuntimeBatcher> | null;
|
|
94
109
|
preparedTools: Awaited<ReturnType<OpenGeniRuntime["prepareTools"]>> | null;
|
|
@@ -106,7 +121,10 @@ export type EventingState = {
|
|
|
106
121
|
firstModelRequestPreparationStartedAt: number | null;
|
|
107
122
|
firstModelRequestPreparationRecorded: boolean;
|
|
108
123
|
firstModelRequestCheckpointAt: number | null;
|
|
124
|
+
initialModelWireDispatch: InitialModelWireDispatchClock;
|
|
109
125
|
companyBrainContextContributions: readonly ModelContextContributionSummary[] | null;
|
|
126
|
+
/** Skill ids in this turn's frozen, model-visible Skill index; telemetry only. */
|
|
127
|
+
modelVisibleSkillIds: ReadonlySet<string> | null;
|
|
110
128
|
};
|
|
111
129
|
/** Rig telemetry (M3): set once the session loads; empty string for a rig-less
|
|
112
130
|
* turn (mirrors variableSetId). Read by the activity span's finally block. */
|
|
@@ -121,8 +139,18 @@ export type ProviderTurnState = {
|
|
|
121
139
|
effectiveCodexCredentialVersion: number | null;
|
|
122
140
|
/** Frozen alternate-account ceiling observed by the fenced allocator. */
|
|
123
141
|
codexCredentialFailoverLimit: number;
|
|
142
|
+
/**
|
|
143
|
+
* Accepted product model id (`codex/<slug>`) the Codex allocator filtered
|
|
144
|
+
* for. Failure settlement scopes plan entitlement and failover to it.
|
|
145
|
+
*/
|
|
146
|
+
codexProductModelId?: string | null;
|
|
124
147
|
/** Accepted Codex allocator policy captured with the first durable lease. */
|
|
125
148
|
codexPolicySnapshot: CodexCredentialPolicySnapshotV1 | null;
|
|
149
|
+
effectiveClaudeCredentialId: string | null;
|
|
150
|
+
effectiveClaudeCredentialVersion: number | null;
|
|
151
|
+
claudeUpstreamModelId: string | null;
|
|
152
|
+
claudeRotationEnabled: boolean;
|
|
153
|
+
claudeAuthoritySnapshot: XaiProviderAccountAuthoritySnapshotV1 | null;
|
|
126
154
|
effectiveXaiCredentialId: string | null;
|
|
127
155
|
xaiRotationEnabled: boolean;
|
|
128
156
|
xaiAuthoritySnapshot: XaiProviderAccountAuthoritySnapshotV1 | null;
|
|
@@ -130,6 +158,7 @@ export type ProviderTurnState = {
|
|
|
130
158
|
xaiCredentialQuarantined: boolean;
|
|
131
159
|
priorSessionCodexCredentialId: string | null;
|
|
132
160
|
latestCodexUsage: CodexUsageHeaderSnapshot | null;
|
|
161
|
+
latestClaudeUsage: Map<string, import("./claude-usage-observer.js").CapturedClaudeUsage>;
|
|
133
162
|
lastCodexRequestOpaqueArtifacts: readonly string[];
|
|
134
163
|
};
|
|
135
164
|
export type TurnContext = {
|