@halonicjs/testing 0.1.0 → 0.1.2
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/NOTICE +4 -0
- package/README.md +1 -1
- package/dist/adapters/http-kit/src/address-checking.d.ts +19 -0
- package/dist/adapters/http-kit/src/address-checking.js +1 -0
- package/dist/adapters/http-kit/src/connector-host-class.d.ts +14 -0
- package/dist/adapters/http-kit/src/connector-host-class.js +34 -0
- package/dist/adapters/http-kit/src/index.d.ts +3 -0
- package/dist/adapters/http-kit/src/index.js +2 -0
- package/dist/adapters/http-kit/src/ollama-tags.d.ts +20 -0
- package/dist/adapters/http-kit/src/ollama-tags.js +38 -0
- package/dist/adapters/integration-kit/src/auth-placement.d.ts +40 -0
- package/dist/adapters/integration-kit/src/auth-placement.js +102 -0
- package/dist/adapters/integration-kit/src/current-secret-forms.d.ts +28 -0
- package/dist/adapters/integration-kit/src/current-secret-forms.js +60 -0
- package/dist/adapters/integration-kit/src/declaration.d.ts +2 -1
- package/dist/adapters/integration-kit/src/declaration.js +4 -3
- package/dist/adapters/integration-kit/src/host.d.ts +7 -1
- package/dist/adapters/integration-kit/src/host.js +1 -0
- package/dist/adapters/integration-kit/src/index.d.ts +5 -2
- package/dist/adapters/integration-kit/src/index.js +2 -0
- package/dist/adapters/integration-kit/src/leak-attempt.d.ts +4 -2
- package/dist/adapters/integration-kit/src/leak-attempt.js +5 -2
- package/dist/adapters/integration-kit/src/limited-http.d.ts +7 -1
- package/dist/adapters/integration-kit/src/limited-http.js +53 -10
- package/dist/adapters/integration-kit/src/loader.d.ts +28 -11
- package/dist/adapters/integration-kit/src/loader.js +36 -21
- package/dist/adapters/integration-kit/src/own-request.d.ts +2 -2
- package/dist/adapters/integration-kit/src/own-request.js +1 -1
- package/dist/adapters/integration-kit/src/plugin-load.d.ts +3 -3
- package/dist/adapters/integration-kit/src/plugin-load.js +5 -5
- package/dist/adapters/integration-kit/src/policy.d.ts +28 -0
- package/dist/adapters/integration-kit/src/response-body.d.ts +6 -2
- package/dist/adapters/integration-kit/src/secret-filter.d.ts +3 -3
- package/dist/adapters/integration-kit/src/secret-filter.js +19 -4
- package/dist/adapters/integration-kit/src/secret-in-request.d.ts +3 -0
- package/dist/adapters/integration-kit/src/secret-in-request.js +8 -2
- package/dist/adapters/integration-kit/src/secret-placement.d.ts +35 -25
- package/dist/adapters/integration-kit/src/secret-placement.js +65 -95
- package/dist/adapters/integration-kit/src/sign-in-placement.d.ts +29 -0
- package/dist/adapters/integration-kit/src/sign-in-placement.js +92 -0
- package/dist/adapters/integration-kit/src/workspace-choices.d.ts +37 -0
- package/dist/adapters/integration-kit/src/workspace-choices.js +37 -0
- package/dist/core/events/src/blocked-sites.d.ts +57 -0
- package/dist/core/events/src/blocked-sites.js +89 -0
- package/dist/core/events/src/connector-listing-failed.d.ts +18 -0
- package/dist/core/events/src/connector-listing-failed.js +1 -0
- package/dist/core/events/src/home-path.d.ts +4 -1
- package/dist/core/events/src/home-path.js +14 -3
- package/dist/core/events/src/index.d.ts +8 -2
- package/dist/core/events/src/index.js +5 -0
- package/dist/core/events/src/provider-notes.d.ts +16 -0
- package/dist/core/events/src/provider-notes.js +24 -0
- package/dist/core/events/src/run-basics.d.ts +131 -10
- package/dist/core/events/src/run-event.d.ts +120 -11
- package/dist/core/events/src/run-reads.d.ts +25 -0
- package/dist/core/events/src/run-reads.js +44 -0
- package/dist/core/events/src/run-sends.d.ts +47 -0
- package/dist/core/events/src/run-sends.js +68 -0
- package/dist/core/events/src/run-summary.d.ts +11 -1
- package/dist/core/events/src/sandbox-opened-read.d.ts +2 -1
- package/dist/core/events/src/sandbox-opened-read.js +27 -2
- package/dist/core/events/src/sandbox-opened.d.ts +37 -4
- package/dist/core/events/src/sandbox-opened.js +13 -3
- package/dist/core/events/src/summarize.js +8 -1
- package/dist/core/events/src/timeline-entry.js +1 -0
- package/dist/core/events/src/tool-failure-cause.d.ts +25 -0
- package/dist/core/events/src/tool-failure-cause.js +66 -0
- package/dist/core/format/src/index.d.ts +9 -6
- package/dist/core/format/src/index.js +7 -3
- package/dist/core/format/src/integration/index.d.ts +3 -2
- package/dist/core/format/src/integration/index.js +2 -1
- package/dist/core/format/src/kinds/agent/harness-limits.d.ts +14 -0
- package/dist/core/format/src/kinds/agent/harness-limits.js +27 -0
- package/dist/core/format/src/kinds/agent/sandbox-fields.d.ts +15 -5
- package/dist/core/format/src/kinds/agent/sandbox-fields.js +29 -10
- package/dist/core/format/src/kinds/agent/schema.d.ts +5 -0
- package/dist/core/format/src/kinds/agent/schema.js +5 -2
- package/dist/core/format/src/kinds/connector/is-local.js +1 -1
- package/dist/core/format/src/kinds/connector/kind.js +122 -2
- package/dist/core/format/src/kinds/connector/schema.d.ts +38 -0
- package/dist/core/format/src/kinds/connector/schema.js +71 -2
- package/dist/core/format/src/kinds/deployments/kind.js +25 -1
- package/dist/core/format/src/kinds/deployments/schema.d.ts +40 -0
- package/dist/core/format/src/kinds/deployments/schema.js +52 -0
- package/dist/core/format/src/kinds/integration/approved-sign-ins.d.ts +62 -0
- package/dist/core/format/src/kinds/integration/approved-sign-ins.js +125 -0
- package/dist/core/format/src/kinds/integration/host-key.d.ts +7 -0
- package/dist/core/format/src/kinds/integration/host-key.js +8 -0
- package/dist/core/format/src/kinds/integration/kind.d.ts +4 -2
- package/dist/core/format/src/kinds/integration/kind.js +49 -12
- package/dist/core/format/src/kinds/integration/policy.d.ts +47 -2
- package/dist/core/format/src/kinds/integration/policy.js +61 -2
- package/dist/core/format/src/kinds/integration/schema.d.ts +180 -3
- package/dist/core/format/src/kinds/integration/schema.js +133 -7
- package/dist/core/format/src/kinds/integration/sign-in-checks.d.ts +14 -0
- package/dist/core/format/src/kinds/integration/sign-in-checks.js +150 -0
- package/dist/core/format/src/kinds/integration/sign-in-urls.d.ts +19 -0
- package/dist/core/format/src/kinds/integration/sign-in-urls.js +47 -0
- package/dist/core/format/src/kinds/plugin/checks.d.ts +3 -2
- package/dist/core/format/src/kinds/plugin/checks.js +24 -6
- package/dist/core/format/src/kinds/plugin/schema.d.ts +130 -0
- package/dist/core/format/src/kinds/plugin/schema.js +26 -6
- package/dist/core/format/src/kinds/plugin/ui-checks.d.ts +1 -1
- package/dist/core/format/src/kinds/plugin/ui-checks.js +1 -10
- package/dist/core/format/src/kinds/provider/kind.js +40 -1
- package/dist/core/format/src/kinds/provider/types.d.ts +19 -0
- package/dist/core/format/src/kinds/provider/types.js +22 -0
- package/dist/core/format/src/kinds/routine/kind.js +38 -1
- package/dist/core/format/src/kinds/routine/schema.d.ts +20 -5
- package/dist/core/format/src/kinds/routine/schema.js +42 -14
- package/dist/core/format/src/kinds/routine/webhook-headers.d.ts +9 -0
- package/dist/core/format/src/kinds/routine/webhook-headers.js +26 -0
- package/dist/core/format/src/kinds/workflow/schema.js +1 -1
- package/dist/core/format/src/kinds/workspace/kind.js +1 -1
- package/dist/core/format/src/kinds/workspace/schema.d.ts +2 -2
- package/dist/core/format/src/kinds/workspace/schema.js +6 -5
- package/dist/core/format/src/parse-file.js +3 -1
- package/dist/core/format/src/shared/fields.d.ts +12 -8
- package/dist/core/format/src/shared/fields.js +48 -19
- package/dist/core/format/src/shared/guard.d.ts +8 -0
- package/dist/core/format/src/shared/guard.js +50 -1
- package/dist/core/format/src/shared/missing-keys.d.ts +17 -0
- package/dist/core/format/src/shared/missing-keys.js +110 -0
- package/dist/core/ports/src/agent-runs-not-available.d.ts +21 -0
- package/dist/core/ports/src/agent-runs-not-available.js +25 -0
- package/dist/core/ports/src/blob-store.d.ts +12 -0
- package/dist/core/ports/src/blob-store.js +22 -0
- package/dist/core/ports/src/chat.d.ts +8 -0
- package/dist/core/ports/src/connector-client.d.ts +48 -4
- package/dist/core/ports/src/connector-client.js +17 -0
- package/dist/core/ports/src/connector-start-failure.d.ts +31 -0
- package/dist/core/ports/src/connector-start-failure.js +32 -0
- package/dist/core/ports/src/connector-tool-error.d.ts +33 -0
- package/dist/core/ports/src/connector-tool-error.js +40 -0
- package/dist/core/ports/src/definition-store-left-out.d.ts +46 -0
- package/dist/core/ports/src/definition-store-left-out.js +47 -0
- package/dist/core/ports/src/definition-store.d.ts +36 -5
- package/dist/core/ports/src/definition-store.js +1 -1
- package/dist/core/ports/src/deploy-target.d.ts +358 -0
- package/dist/core/ports/src/deploy-target.js +2 -0
- package/dist/core/ports/src/harness-bridge-server.d.ts +67 -7
- package/dist/core/ports/src/harness-sign-in-command.d.ts +27 -0
- package/dist/core/ports/src/harness-sign-in-command.js +31 -0
- package/dist/core/ports/src/harness.d.ts +79 -15
- package/dist/core/ports/src/harness.js +1 -1
- package/dist/core/ports/src/host-settings-store.d.ts +116 -0
- package/dist/core/ports/src/host-settings-store.js +106 -0
- package/dist/core/ports/src/host-too-old.d.ts +23 -0
- package/dist/core/ports/src/host-too-old.js +27 -0
- package/dist/core/ports/src/index.d.ts +32 -13
- package/dist/core/ports/src/index.js +28 -8
- package/dist/core/ports/src/instruction-trust-store.d.ts +81 -0
- package/dist/core/ports/src/instruction-trust-store.js +43 -0
- package/dist/core/ports/src/integration.d.ts +71 -7
- package/dist/core/ports/src/integration.js +22 -4
- package/dist/core/ports/src/llm-provider.d.ts +39 -6
- package/dist/core/ports/src/llm-provider.js +46 -3
- package/dist/core/ports/src/pairing-codes.d.ts +111 -0
- package/dist/core/ports/src/pairing-codes.js +336 -0
- package/dist/core/ports/src/pairing-qr-bytes.d.ts +32 -0
- package/dist/core/ports/src/pairing-qr-bytes.js +116 -0
- package/dist/core/ports/src/password-hasher.d.ts +36 -20
- package/dist/core/ports/src/port-versions.d.ts +13 -6
- package/dist/core/ports/src/port-versions.js +14 -0
- package/dist/core/ports/src/program-probe.d.ts +25 -2
- package/dist/core/ports/src/program-probe.js +1 -1
- package/dist/core/ports/src/provider-default-base-url.d.ts +10 -0
- package/dist/core/ports/src/provider-default-base-url.js +18 -0
- package/dist/core/ports/src/record-store.d.ts +17 -0
- package/dist/core/ports/src/record-store.js +70 -0
- package/dist/core/ports/src/remote-control.d.ts +159 -0
- package/dist/core/ports/src/remote-control.js +26 -0
- package/dist/core/ports/src/remote-gateway-protocol.d.ts +220 -0
- package/dist/core/ports/src/remote-gateway-protocol.js +62 -0
- package/dist/core/ports/src/remote-gateway-session.d.ts +194 -0
- package/dist/core/ports/src/remote-gateway-session.js +241 -0
- package/dist/core/ports/src/run-executor.d.ts +44 -7
- package/dist/core/ports/src/run-executor.js +1 -1
- package/dist/core/ports/src/run-target-not-found.d.ts +34 -0
- package/dist/core/ports/src/run-target-not-found.js +41 -0
- package/dist/core/ports/src/sandbox-setting-store.d.ts +68 -0
- package/dist/core/ports/src/sandbox-setting-store.js +33 -0
- package/dist/core/ports/src/sandbox.d.ts +149 -13
- package/dist/core/ports/src/sandbox.js +52 -2
- package/dist/core/ports/src/secrets.d.ts +105 -1
- package/dist/core/ports/src/secrets.js +75 -2
- package/dist/core/ports/src/tool-approval-store.d.ts +50 -8
- package/dist/core/ports/src/tool-approval-store.js +59 -0
- package/dist/core/ports/src/tunnel-provider.d.ts +117 -0
- package/dist/core/ports/src/tunnel-provider.js +65 -0
- package/dist/core/ports/src/tunnel-resolver.d.ts +83 -0
- package/dist/core/ports/src/tunnel-resolver.js +36 -0
- package/dist/core/ports/src/vcs-status.d.ts +8 -0
- package/dist/core/ports/src/vcs-status.js +90 -0
- package/dist/core/ports/src/vcs.d.ts +30 -0
- package/dist/core/schema-kit/src/builders.d.ts +5 -0
- package/dist/core/schema-kit/src/builders.js +5 -0
- package/dist/core/std/src/amount.d.ts +13 -0
- package/dist/core/std/src/amount.js +22 -0
- package/dist/core/std/src/hidden-characters.d.ts +28 -0
- package/dist/core/std/src/hidden-characters.js +72 -0
- package/dist/core/std/src/index.d.ts +7 -0
- package/dist/core/std/src/index.js +7 -0
- package/dist/core/std/src/path-overlap.d.ts +22 -0
- package/dist/core/std/src/path-overlap.js +57 -0
- package/dist/core/std/src/public-suffixes.generated.d.ts +9 -0
- package/dist/core/std/src/public-suffixes.generated.js +10428 -0
- package/dist/core/std/src/registrable-domain.d.ts +10 -0
- package/dist/core/std/src/registrable-domain.js +62 -0
- package/dist/core/std/src/secret-variable-name.d.ts +12 -0
- package/dist/core/std/src/secret-variable-name.js +34 -0
- package/dist/core/std/src/site-name.d.ts +35 -0
- package/dist/core/std/src/site-name.js +111 -0
- package/dist/core/std/src/url-host.d.ts +35 -0
- package/dist/core/std/src/url-host.js +170 -0
- package/dist/core/std/src/word-diff.d.ts +28 -0
- package/dist/core/std/src/word-diff.js +77 -0
- package/dist/core/yaml/src/edit-data.d.ts +7 -0
- package/dist/core/yaml/src/edit-data.js +62 -3
- package/dist/core/yaml/src/edit.d.ts +7 -0
- package/dist/core/yaml/src/edit.js +34 -3
- package/dist/core/yaml/src/splice-node.d.ts +6 -0
- package/dist/core/yaml/src/splice-node.js +10 -0
- package/dist/core/yaml/src/splice.js +20 -10
- package/dist/testing/integration/src/checks.d.ts +5 -3
- package/dist/testing/integration/src/checks.js +31 -3
- package/dist/testing/integration/src/load.js +3 -1
- package/package.json +9 -2
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
export { addUsage } from "./add-usage.js";
|
|
2
2
|
export type { AgentResume, LoggedToolCall } from "./agent-resume.js";
|
|
3
|
-
export
|
|
3
|
+
export { type BlockedSite, type BlockedSitesOptions, blockedSites, type StepBlockedSites, } from "./blocked-sites.js";
|
|
4
|
+
export { providerNotes } from "./provider-notes.js";
|
|
5
|
+
export type { ApprovalResolver, CantTryReason, CantTryStep, ConnectorStartReason, HarnessStartCause, InstructionsRefusal, LeftOutReason, LoggedInstructionPin, ModelSkipReason, ProviderText, RunCatchUp, RunFailureCause, RunFailureKind, RunFailureReason, RunKind, RunParent, RunStatus, RunTrigger, RunVersion, StoredBlob, ToolFailureCause, ToolNotMadeReason, ToolNoun, ToolOutcome, ToolRefusalReason, ToolRisk, ToolUnaskedReason, ToolVerb, Usage, } from "./run-basics.js";
|
|
4
6
|
export type { RunEvent, RunEventBase, RunEventBody, RunEventType } from "./run-event.js";
|
|
7
|
+
export { draftsOf, readsOf } from "./run-reads.js";
|
|
8
|
+
export type { RunSends, SendCount, SendGroup } from "./run-sends.js";
|
|
9
|
+
export { sendsOf } from "./run-sends.js";
|
|
5
10
|
export type { PendingApproval, RunSummary, SentSignal } from "./run-summary.js";
|
|
6
11
|
export type { LoggedSandboxBlock, SandboxBlock } from "./sandbox-blocked.js";
|
|
7
12
|
export { maxBlockedTargetsPerStep, sandboxBlockedView } from "./sandbox-blocked.js";
|
|
8
|
-
export type { DeniedPathGroup, DeniedPathGroupCode, SandboxOpenedOptions, SandboxOpenedView, SandboxStrength, ShownSandboxProfile, } from "./sandbox-opened.js";
|
|
13
|
+
export type { DeniedPathGroup, DeniedPathGroupCode, SandboxOpenedOptions, SandboxOpenedView, SandboxSignIn, SandboxStrength, ShownSandboxProfile, SubscriptionProvider, } from "./sandbox-opened.js";
|
|
9
14
|
export { deniedPathGroupCodes, sandboxOpenedView } from "./sandbox-opened.js";
|
|
10
15
|
export { readSandboxOpened } from "./sandbox-opened-read.js";
|
|
11
16
|
export { summarize } from "./summarize.js";
|
|
12
17
|
export { entryOf } from "./timeline-entry.js";
|
|
18
|
+
export { maxCauseNameLength, toolFailureCauseOf } from "./tool-failure-cause.js";
|
|
13
19
|
export { parseEventLine, upgradeEvent } from "./upgrade.js";
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
export { addUsage } from "./add-usage.js";
|
|
2
|
+
export { blockedSites, } from "./blocked-sites.js";
|
|
3
|
+
export { providerNotes } from "./provider-notes.js";
|
|
4
|
+
export { draftsOf, readsOf } from "./run-reads.js";
|
|
5
|
+
export { sendsOf } from "./run-sends.js";
|
|
2
6
|
export { maxBlockedTargetsPerStep, sandboxBlockedView } from "./sandbox-blocked.js";
|
|
3
7
|
export { deniedPathGroupCodes, sandboxOpenedView } from "./sandbox-opened.js";
|
|
4
8
|
export { readSandboxOpened } from "./sandbox-opened-read.js";
|
|
5
9
|
export { summarize } from "./summarize.js";
|
|
6
10
|
export { entryOf } from "./timeline-entry.js";
|
|
11
|
+
export { maxCauseNameLength, toolFailureCauseOf } from "./tool-failure-cause.js";
|
|
7
12
|
export { parseEventLine, upgradeEvent } from "./upgrade.js";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { RunEvent } from "./run-event.js";
|
|
2
|
+
/**
|
|
3
|
+
* The providers' notes on how they changed a run's model calls, each once
|
|
4
|
+
* (requirement `events.provider-notes`): the `notes` of every
|
|
5
|
+
* `llm.response`, in the order each note first came. A run whose calls all
|
|
6
|
+
* left out the same setting says so once. Pure.
|
|
7
|
+
*
|
|
8
|
+
* @param events - the run's events, oldest first
|
|
9
|
+
* @returns each note once; empty when no provider changed a call
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* providerNotes(events);
|
|
13
|
+
* // three calls to claude-sonnet-5-5 with temperature set
|
|
14
|
+
* // => ["Left out temperature: claude-sonnet-5-5 doesn't take it."]
|
|
15
|
+
*/
|
|
16
|
+
export declare function providerNotes(events: readonly RunEvent[]): string[];
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The providers' notes on how they changed a run's model calls, each once
|
|
3
|
+
* (requirement `events.provider-notes`): the `notes` of every
|
|
4
|
+
* `llm.response`, in the order each note first came. A run whose calls all
|
|
5
|
+
* left out the same setting says so once. Pure.
|
|
6
|
+
*
|
|
7
|
+
* @param events - the run's events, oldest first
|
|
8
|
+
* @returns each note once; empty when no provider changed a call
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* providerNotes(events);
|
|
12
|
+
* // three calls to claude-sonnet-5-5 with temperature set
|
|
13
|
+
* // => ["Left out temperature: claude-sonnet-5-5 doesn't take it."]
|
|
14
|
+
*/
|
|
15
|
+
export function providerNotes(events) {
|
|
16
|
+
const notes = new Set();
|
|
17
|
+
for (const event of events) {
|
|
18
|
+
if (event.type !== "llm.response")
|
|
19
|
+
continue;
|
|
20
|
+
for (const note of event.notes ?? [])
|
|
21
|
+
notes.add(note);
|
|
22
|
+
}
|
|
23
|
+
return [...notes];
|
|
24
|
+
}
|
|
@@ -73,7 +73,8 @@ export interface Usage {
|
|
|
73
73
|
}
|
|
74
74
|
/** What started a run. Absent for runs started by hand from a workflow. */
|
|
75
75
|
export interface RunTrigger {
|
|
76
|
-
|
|
76
|
+
/** `inbox`: the person started it from the Inbox's request form; `manual`: with Run, or a routine's Run now. */
|
|
77
|
+
type: "manual" | "inbox" | "schedule" | "every" | "mail" | "signal" | "webhook";
|
|
77
78
|
/** Routine key: "<hubId>/<routineId>" or "@workspace/<routineId>". */
|
|
78
79
|
routineId?: string;
|
|
79
80
|
/** ISO time the run was due (the scheduled time, not when it actually started). */
|
|
@@ -82,6 +83,8 @@ export interface RunTrigger {
|
|
|
82
83
|
messageId?: string;
|
|
83
84
|
/** Signal triggers: "<runId>:<seq>" of the signal that started this run (one run per signal). */
|
|
84
85
|
signalId?: string;
|
|
86
|
+
/** Webhook triggers: the sender's delivery id of the request that started this run (one run per delivery). */
|
|
87
|
+
deliveryId?: string;
|
|
85
88
|
/**
|
|
86
89
|
* Routine runs that started later than the tick's grace after `at`, such
|
|
87
90
|
* as after the computer slept or Halonic was closed. Absent for a run that
|
|
@@ -128,11 +131,53 @@ export interface RunParent {
|
|
|
128
131
|
* off without an answer, so it may or may not have done its work (`unknown`).
|
|
129
132
|
*/
|
|
130
133
|
export type ToolOutcome = "ok" | "error" | "unknown";
|
|
134
|
+
/**
|
|
135
|
+
* Why the engine didn't make a connector call (requirement
|
|
136
|
+
* `events.tool-result-cause`): `not-connected`, the agent's connector isn't
|
|
137
|
+
* among the run's; `tool-gone`, the connector no longer offers the tool;
|
|
138
|
+
* `sending-off`, the tool sends and sending is off for the connector;
|
|
139
|
+
* `bad-arguments`, the call's arguments aren't an object.
|
|
140
|
+
*/
|
|
141
|
+
export type ToolNotMadeReason = "not-connected" | "tool-gone" | "sending-off" | "bad-arguments";
|
|
142
|
+
/** Why a run's connectors didn't start, when the engine knows (requirement `events.tool-result-cause`). */
|
|
143
|
+
export type ConnectorStartReason = "program-missing" | "secret-not-set" | "other";
|
|
144
|
+
/**
|
|
145
|
+
* Why a tool call failed, when the engine knows (requirement
|
|
146
|
+
* `events.tool-result-cause`):
|
|
147
|
+
*
|
|
148
|
+
* - `time-limit`: the tool didn't answer within `seconds`.
|
|
149
|
+
* - `engine-stopped`: the engine stopped while the call was going.
|
|
150
|
+
* - `not-made`: the engine didn't make the call, for the reason in `why`.
|
|
151
|
+
* - `connector-not-started`: the run's connectors didn't start. `name` is
|
|
152
|
+
* the program or the secret's name as the connector's file writes it,
|
|
153
|
+
* never a secret's value or a program's output.
|
|
154
|
+
*
|
|
155
|
+
* Read it with `toolFailureCauseOf`: a cause it doesn't know reads as absent.
|
|
156
|
+
*/
|
|
157
|
+
export type ToolFailureCause = {
|
|
158
|
+
readonly code: "time-limit";
|
|
159
|
+
readonly seconds: number;
|
|
160
|
+
} | {
|
|
161
|
+
readonly code: "engine-stopped";
|
|
162
|
+
} | {
|
|
163
|
+
readonly code: "not-made";
|
|
164
|
+
readonly why: ToolNotMadeReason;
|
|
165
|
+
} | {
|
|
166
|
+
readonly code: "connector-not-started";
|
|
167
|
+
readonly why: ConnectorStartReason;
|
|
168
|
+
readonly name?: string;
|
|
169
|
+
};
|
|
131
170
|
/**
|
|
132
171
|
* Why a model's tool call was refused before it ran (requirement
|
|
133
172
|
* `events.tool-refused`): `not-offered`, the step offered no tool of that name.
|
|
134
173
|
*/
|
|
135
174
|
export type ToolRefusalReason = "not-offered";
|
|
175
|
+
/**
|
|
176
|
+
* Why a connector's tool call ran without asking a person (requirement
|
|
177
|
+
* `events.tool-unasked`): `read-list`, the `read` list of the connector's
|
|
178
|
+
* file names the tool.
|
|
179
|
+
*/
|
|
180
|
+
export type ToolUnaskedReason = "read-list";
|
|
136
181
|
/**
|
|
137
182
|
* Where a payload too large for the run log is kept: the hash of its bytes
|
|
138
183
|
* in the run's blob store, their size and their media type. The same shape
|
|
@@ -152,14 +197,23 @@ export interface StoredBlob {
|
|
|
152
197
|
*/
|
|
153
198
|
export type ToolRisk = "read" | "write" | "send";
|
|
154
199
|
/**
|
|
155
|
-
* What one call of a
|
|
156
|
-
* its integration's sheet names it, such as
|
|
157
|
-
* Both are stored so a reader never has to
|
|
200
|
+
* What one call of a tool sends, reads or drafts, in the singular and the
|
|
201
|
+
* plural, as its integration's sheet names it, such as
|
|
202
|
+
* `{ one: "email", many: "emails" }`. Both are stored so a reader never has to
|
|
203
|
+
* make a plural itself.
|
|
158
204
|
*/
|
|
159
205
|
export interface ToolNoun {
|
|
160
206
|
one: string;
|
|
161
207
|
many: string;
|
|
162
208
|
}
|
|
209
|
+
/**
|
|
210
|
+
* What one call of a tool did to its noun, in the past tense, as its
|
|
211
|
+
* integration's sheet says: "saved" reads "Saved 1 file". A closed list, so a
|
|
212
|
+
* sheet can't word a send as something milder; absent means "sent". `drafted`
|
|
213
|
+
* is for a `write` tool that prepares something without sending it ("Drafted
|
|
214
|
+
* 1 email"), and a `send` tool may never use it.
|
|
215
|
+
*/
|
|
216
|
+
export type ToolVerb = "sent" | "saved" | "created" | "updated" | "moved" | "drafted";
|
|
163
217
|
/**
|
|
164
218
|
* Why a run failed. Each reason has its own requirement in `requirements/`.
|
|
165
219
|
*
|
|
@@ -170,10 +224,12 @@ export interface ToolNoun {
|
|
|
170
224
|
* - `error`: something else went wrong; the `error` text says what.
|
|
171
225
|
* - `model-unreachable`: the model's host didn't answer; `run.failed` names it in `host`.
|
|
172
226
|
* - `model-out-of-memory`: the machine running the model ran out of memory for it.
|
|
227
|
+
* - `model-timeout`: the model's provider was reached but gave no first answer in time (5 minutes by default);
|
|
228
|
+
* `run.failed` names its host in `host` when it is known.
|
|
173
229
|
* - `disk-full`: there was no disk space left to write what the run needed.
|
|
174
230
|
* - `interrupted`: the engine stopped while the run was going, and found it on its next start.
|
|
175
231
|
* - `sandbox-not-ready`: the sandbox check failed, so the step that needs the sandbox didn't
|
|
176
|
-
* start; `run.failed` gives the check's reason code in `sandboxReason`.
|
|
232
|
+
* start; `run.failed` gives the check's reason code in `sandboxReason` and the refused agent in `agent`.
|
|
177
233
|
* - `sandbox-start-failed`: the sandbox check had passed, but the sandbox didn't start for this run.
|
|
178
234
|
* - `harness-start-failed`: the harness program failed to start for this run, or didn't send its
|
|
179
235
|
* first event within its time limit (60 s by default).
|
|
@@ -185,8 +241,66 @@ export interface ToolNoun {
|
|
|
185
241
|
* options.
|
|
186
242
|
* - `harness-unavailable`: the step's agent runs in a harness program, and the engine that ran it
|
|
187
243
|
* has no harnesses, as in workflow tests, which never start programs.
|
|
244
|
+
* - `local-only`: the workspace is local only, and no model the step could use runs on this
|
|
245
|
+
* computer, so Halonic called none of them.
|
|
246
|
+
* - `instructions-not-trusted`: the step's harness didn't start, because a person hasn't trusted
|
|
247
|
+
* the agent's instructions (or they changed since); `run.failed` gives the agent in `agent`,
|
|
248
|
+
* the pin the check saw in `pin` and whether something was trusted before in `changed`.
|
|
249
|
+
*/
|
|
250
|
+
export type RunFailureReason = "budget" | "cancelled" | "model-missing" | "model-no-tools" | "error" | "model-unreachable" | "model-out-of-memory" | "model-timeout" | "disk-full" | "interrupted" | "sandbox-not-ready" | "sandbox-start-failed" | "harness-start-failed" | "key-refused" | "out-of-credit" | "provider-busy" | "answer-not-an-option" | "harness-unavailable" | "local-only" | "instructions-not-trusted";
|
|
251
|
+
/**
|
|
252
|
+
* The instructions a harness step started with: the digest of the whole set
|
|
253
|
+
* and each file's digest by name. Only digests, never the text, so a log
|
|
254
|
+
* that is shared doesn't carry what a person wrote.
|
|
188
255
|
*/
|
|
189
|
-
export
|
|
256
|
+
export interface LoggedInstructionPin {
|
|
257
|
+
readonly digest: string;
|
|
258
|
+
readonly files: Readonly<Record<string, string>>;
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* What `run.failed` and a parallel branch's `agent.finished` carry with the
|
|
262
|
+
* reason `instructions-not-trusted` (requirement
|
|
263
|
+
* `events.run-failed-instructions-not-trusted`): the pin the check saw, so a
|
|
264
|
+
* page can ask a person to trust exactly that, and whether a person had
|
|
265
|
+
* trusted instructions for the agent before, so it says "changed" or "not
|
|
266
|
+
* trusted yet" without asking the store again. `changed` is absent when the
|
|
267
|
+
* check didn't answer.
|
|
268
|
+
*/
|
|
269
|
+
export interface InstructionsRefusal {
|
|
270
|
+
readonly pin: LoggedInstructionPin;
|
|
271
|
+
readonly changed?: boolean;
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* Why a harness program didn't start, when the engine knows (requirement
|
|
275
|
+
* `events.run-failed-harness-cause`): `not-installed` when the program isn't
|
|
276
|
+
* on this computer, `signed-out` when it is but no one is signed in to it for
|
|
277
|
+
* the agent. A reader that doesn't know a cause reads it as absent.
|
|
278
|
+
*/
|
|
279
|
+
export type HarnessStartCause = "not-installed" | "signed-out";
|
|
280
|
+
/**
|
|
281
|
+
* How a surface responds to a failure: the kit's error kinds. This package
|
|
282
|
+
* may not import `@halonicjs/std`, so it holds its own list; the engine's
|
|
283
|
+
* type test (requirement `engine.run-failure-cause-of`) fails when it and
|
|
284
|
+
* `ErrorKind` differ.
|
|
285
|
+
*/
|
|
286
|
+
export type RunFailureKind = "invalid_input" | "not_found" | "conflict" | "unauthenticated" | "denied" | "limit_reached" | "unavailable" | "internal";
|
|
287
|
+
/**
|
|
288
|
+
* The typed cause of a failed run, for a screen that has to tell one failure
|
|
289
|
+
* from another without reading the free-text `error` (requirement
|
|
290
|
+
* `events.run-failed-cause`), such as Studio's "API off" banner.
|
|
291
|
+
*
|
|
292
|
+
* `kind` is the error kind the failing error carried, one of the kit's eight
|
|
293
|
+
* (the engine's type test keeps {@link RunFailureKind} equal to `ErrorKind`). `code` is a stable
|
|
294
|
+
* string for a cause a screen knows by name, such as `google.api-disabled`;
|
|
295
|
+
* a reader that doesn't know a code still has `kind`. `detail` holds a few
|
|
296
|
+
* short strings that cause names, such as the API, the project and a link
|
|
297
|
+
* that fixes it. It never holds a credential or a provider's own text.
|
|
298
|
+
*/
|
|
299
|
+
export interface RunFailureCause {
|
|
300
|
+
readonly kind: RunFailureKind;
|
|
301
|
+
readonly code?: string;
|
|
302
|
+
readonly detail?: Readonly<Record<string, string>>;
|
|
303
|
+
}
|
|
190
304
|
/**
|
|
191
305
|
* The model provider's own error text, kept in the run log for `--debug` and
|
|
192
306
|
* Copy details only (requirement `events.provider-text`). Studio and the
|
|
@@ -199,7 +313,14 @@ export interface ProviderText {
|
|
|
199
313
|
status?: number;
|
|
200
314
|
text: string;
|
|
201
315
|
}
|
|
202
|
-
/**
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
316
|
+
/**
|
|
317
|
+
* Why a model was skipped before it was called: its provider's key isn't set
|
|
318
|
+
* (`no-key`), or the workspace is local only and the provider isn't local
|
|
319
|
+
* (`local-only`).
|
|
320
|
+
*/
|
|
321
|
+
export type ModelSkipReason = "no-key" | "local-only";
|
|
322
|
+
/**
|
|
323
|
+
* Who resolved an approval: a person at the screen, a person on a remote
|
|
324
|
+
* device (a phone), or a rule that answers without asking anyone.
|
|
325
|
+
*/
|
|
326
|
+
export type ApprovalResolver = "person" | "remote-device" | "rule";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { AgentResume } from "./agent-resume.js";
|
|
2
|
-
import type {
|
|
2
|
+
import type { ConnectorListingFailedEvent } from "./connector-listing-failed.js";
|
|
3
|
+
import type { ApprovalResolver, CantTryStep, HarnessStartCause, LoggedInstructionPin, ModelSkipReason, ProviderText, RunFailureCause, RunFailureReason, RunKind, RunParent, RunTrigger, RunVersion, StoredBlob, ToolFailureCause, ToolNoun, ToolOutcome, ToolRefusalReason, ToolRisk, ToolUnaskedReason, ToolVerb, Usage } from "./run-basics.js";
|
|
3
4
|
import type { LoggedSandboxBlock } from "./sandbox-blocked.js";
|
|
4
5
|
import type { SandboxOpenedView } from "./sandbox-opened.js";
|
|
5
6
|
/** The fields every event in a run log has, whatever its type. */
|
|
@@ -65,11 +66,22 @@ export type RunEventBody = {
|
|
|
65
66
|
agent: string;
|
|
66
67
|
prompt: string;
|
|
67
68
|
parent?: string;
|
|
68
|
-
}
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* `alias`: the model alias the call went to, such as `fast`; absent in
|
|
72
|
+
* older logs and when the model has none (requirement
|
|
73
|
+
* `engine.llm-request-alias`). `address`: the `host:port` of a provider on
|
|
74
|
+
* this computer, such as `localhost:11434`, never a URL, path or user
|
|
75
|
+
* name; absent for any other provider and in older logs (requirement
|
|
76
|
+
* `engine.llm-event-address`).
|
|
77
|
+
*/
|
|
78
|
+
| {
|
|
69
79
|
type: "llm.request";
|
|
70
80
|
agent: string;
|
|
71
81
|
provider: string;
|
|
72
82
|
model: string;
|
|
83
|
+
alias?: string;
|
|
84
|
+
address?: string;
|
|
73
85
|
messages: number;
|
|
74
86
|
} | {
|
|
75
87
|
type: "llm.response";
|
|
@@ -107,17 +119,32 @@ export type RunEventBody = {
|
|
|
107
119
|
* `events.tool-call-as-text`). That call never runs. Absent otherwise.
|
|
108
120
|
*/
|
|
109
121
|
toolCallAsText?: true;
|
|
122
|
+
/**
|
|
123
|
+
* The provider's plain sentences on how it changed the call, such as
|
|
124
|
+
* a setting the model doesn't take (requirement
|
|
125
|
+
* `events.provider-notes`). Kept on every call they came with; shown
|
|
126
|
+
* once per run (`providerNotes`). Absent otherwise.
|
|
127
|
+
*/
|
|
128
|
+
notes?: string[];
|
|
110
129
|
}
|
|
111
130
|
/**
|
|
112
131
|
* The call moved on to the next model. `providerText`: the provider's own
|
|
113
132
|
* error text, for `--debug` and Copy details only (requirement
|
|
114
133
|
* `events.provider-text`); absent in older logs and when it gave none.
|
|
134
|
+
* `provider`, `model`, `alias` and `address` name the model it moved to,
|
|
135
|
+
* as `llm.request` does, so a reader stops naming the one that failed
|
|
136
|
+
* (requirement `engine.llm-event-address`); absent in older logs, and
|
|
137
|
+
* `alias` and `address` as in `llm.request`.
|
|
115
138
|
*/
|
|
116
139
|
| {
|
|
117
140
|
type: "llm.fallback";
|
|
118
141
|
agent: string;
|
|
119
142
|
from: string;
|
|
120
143
|
to: string;
|
|
144
|
+
provider?: string;
|
|
145
|
+
model?: string;
|
|
146
|
+
alias?: string;
|
|
147
|
+
address?: string;
|
|
121
148
|
error: string;
|
|
122
149
|
providerText?: ProviderText;
|
|
123
150
|
}
|
|
@@ -134,6 +161,19 @@ export type RunEventBody = {
|
|
|
134
161
|
model: string;
|
|
135
162
|
reason: ModelSkipReason;
|
|
136
163
|
next?: string;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* A request of the agent's program to the harness bridge failed for a reason
|
|
167
|
+
* the bridge didn't name to the program, which was told the run log has the
|
|
168
|
+
* details (requirement `events.bridge-failed`). `kind`: the error kind of
|
|
169
|
+
* `@halonicjs/std`, such as `internal`. `message`: the error's own text,
|
|
170
|
+
* never holding the run token. It never counts towards a budget.
|
|
171
|
+
*/
|
|
172
|
+
| {
|
|
173
|
+
type: "bridge.failed";
|
|
174
|
+
agent: string;
|
|
175
|
+
kind: string;
|
|
176
|
+
message: string;
|
|
137
177
|
} | {
|
|
138
178
|
type: "tool.called";
|
|
139
179
|
agent: string;
|
|
@@ -154,6 +194,20 @@ export type RunEventBody = {
|
|
|
154
194
|
toolCallId: string;
|
|
155
195
|
reason: ToolRefusalReason;
|
|
156
196
|
}
|
|
197
|
+
/**
|
|
198
|
+
* A connector's tool call is about to run without asking a person,
|
|
199
|
+
* because the `read` list of the connector's file names the tool
|
|
200
|
+
* (requirement `events.tool-unasked`). `connector`: the connector's id.
|
|
201
|
+
* `tool`: the name the model called. Written before the call, so it shows
|
|
202
|
+
* even when the call fails.
|
|
203
|
+
*/
|
|
204
|
+
| {
|
|
205
|
+
type: "tool.unasked";
|
|
206
|
+
agent: string;
|
|
207
|
+
connector: string;
|
|
208
|
+
tool: string;
|
|
209
|
+
reason: ToolUnaskedReason;
|
|
210
|
+
}
|
|
157
211
|
/**
|
|
158
212
|
* A step's sandbox is being opened (requirement `events.started-events`).
|
|
159
213
|
* Written before the call, so a screen can say what the step waits for;
|
|
@@ -177,6 +231,24 @@ export type RunEventBody = {
|
|
|
177
231
|
harness: string;
|
|
178
232
|
timeoutMs: number;
|
|
179
233
|
}
|
|
234
|
+
/**
|
|
235
|
+
* The instructions a step's harness runs with, pinned by content hash
|
|
236
|
+
* (requirement `events.harness-instructions`). Written right before
|
|
237
|
+
* `harness.started`, so a review can tell which instructions a run had.
|
|
238
|
+
* `files` lists `AGENTS.md` and each skill file, with paths relative to the
|
|
239
|
+
* run's folder, never absolute ones; `sha256` is the hash of the whole set.
|
|
240
|
+
* It never holds file contents. Logs written before this event have none.
|
|
241
|
+
*/
|
|
242
|
+
| {
|
|
243
|
+
type: "harness.instructions";
|
|
244
|
+
state: string;
|
|
245
|
+
agent: string;
|
|
246
|
+
files: {
|
|
247
|
+
path: string;
|
|
248
|
+
sha256: string;
|
|
249
|
+
}[];
|
|
250
|
+
sha256: string;
|
|
251
|
+
}
|
|
180
252
|
/**
|
|
181
253
|
* A step's sandbox opened (requirement `events.sandbox-opened`). `sandbox`
|
|
182
254
|
* is a display copy of its profile, never its environment variables.
|
|
@@ -225,7 +297,7 @@ export type RunEventBody = {
|
|
|
225
297
|
agent: string;
|
|
226
298
|
connector: string;
|
|
227
299
|
timeoutMs: number;
|
|
228
|
-
}
|
|
300
|
+
} | ConnectorListingFailedEvent
|
|
229
301
|
/**
|
|
230
302
|
* A step is about to make a connector call that can change things
|
|
231
303
|
* (requirement `events.effect-requested`). Written before the call, so a
|
|
@@ -258,13 +330,16 @@ export type RunEventBody = {
|
|
|
258
330
|
}
|
|
259
331
|
/**
|
|
260
332
|
* `outcome`: how the call ended (requirement `events.tool-result-outcome`).
|
|
261
|
-
* `risk` and `
|
|
262
|
-
*
|
|
263
|
-
* `events.tool-result-risk`). Each is absent in older
|
|
264
|
-
* `noun` for a tool without a sheet.
|
|
333
|
+
* `risk`, `noun` and `verb`: what the tool can do, what one call sends,
|
|
334
|
+
* reads or drafts and what it does to it, copied from its integration's
|
|
335
|
+
* sheet when the call ends (requirement `events.tool-result-risk`). Each is absent in older
|
|
336
|
+
* logs, and `risk`, `noun` and `verb` for a tool without a sheet. A
|
|
337
|
+
* missing `verb` means "sent".
|
|
265
338
|
* `resultBlob`: set when the result was too large for the log; `result`
|
|
266
339
|
* then holds only its start, and the whole result is in the blob store
|
|
267
340
|
* (requirement `events.tool-result-blob`).
|
|
341
|
+
* `cause`: why the call failed, when the engine knows (requirement
|
|
342
|
+
* `events.tool-result-cause`); read it with `toolFailureCauseOf`.
|
|
268
343
|
*/
|
|
269
344
|
| {
|
|
270
345
|
type: "tool.result";
|
|
@@ -274,7 +349,9 @@ export type RunEventBody = {
|
|
|
274
349
|
outcome?: ToolOutcome;
|
|
275
350
|
risk?: ToolRisk;
|
|
276
351
|
noun?: ToolNoun;
|
|
352
|
+
verb?: ToolVerb;
|
|
277
353
|
resultBlob?: StoredBlob;
|
|
354
|
+
cause?: ToolFailureCause;
|
|
278
355
|
}
|
|
279
356
|
/** A connector tool call that needs a person's OK; the run waits for "approve" or "reject". */
|
|
280
357
|
| {
|
|
@@ -287,6 +364,8 @@ export type RunEventBody = {
|
|
|
287
364
|
resume: AgentResume;
|
|
288
365
|
/** The subagent whose call it is (requirement `events.agent-resume-inner`); absent for the state's own agent. */
|
|
289
366
|
subagent?: string;
|
|
367
|
+
/** The connector the tool comes from (requirement `events.approval-requested-connector`); absent in older logs. `tool` stays the bare name. */
|
|
368
|
+
connector?: string;
|
|
290
369
|
} | {
|
|
291
370
|
type: "approval.resolved";
|
|
292
371
|
state: string;
|
|
@@ -295,7 +374,7 @@ export type RunEventBody = {
|
|
|
295
374
|
callId: string;
|
|
296
375
|
approved: boolean;
|
|
297
376
|
comment?: string;
|
|
298
|
-
/** Who resolved it (
|
|
377
|
+
/** Who resolved it (requirements `events.approval-resolved-by` and `events.approval-resolved-remote`); absent in older logs. */
|
|
299
378
|
by?: ApprovalResolver;
|
|
300
379
|
}
|
|
301
380
|
/**
|
|
@@ -305,6 +384,8 @@ export type RunEventBody = {
|
|
|
305
384
|
* that answered.
|
|
306
385
|
* `cantTry`: set instead of `reason` when the agent's step couldn't be
|
|
307
386
|
* tried (requirement `events.run-cant-try`), as a parallel branch reports it.
|
|
387
|
+
* `pin` and `changed`: with the reason `instructions-not-trusted` only, as `run.failed` gives them
|
|
388
|
+
* (requirement `events.run-failed-instructions-not-trusted`); `agent` is the one that didn't start.
|
|
308
389
|
*/
|
|
309
390
|
| {
|
|
310
391
|
type: "agent.finished";
|
|
@@ -314,6 +395,8 @@ export type RunEventBody = {
|
|
|
314
395
|
parent?: string;
|
|
315
396
|
error?: string;
|
|
316
397
|
reason?: RunFailureReason;
|
|
398
|
+
pin?: LoggedInstructionPin;
|
|
399
|
+
changed?: boolean;
|
|
317
400
|
cantTry?: CantTryStep;
|
|
318
401
|
} | {
|
|
319
402
|
type: "artifact.created";
|
|
@@ -360,6 +443,16 @@ export type RunEventBody = {
|
|
|
360
443
|
*/
|
|
361
444
|
context?: Record<string, unknown>;
|
|
362
445
|
}
|
|
446
|
+
/**
|
|
447
|
+
* The child run a waiting `workflow` state waits on runs again, so the run
|
|
448
|
+
* does too and takes no events until the child waits again
|
|
449
|
+
* (requirement `events.workflow-resumed`).
|
|
450
|
+
*/
|
|
451
|
+
| {
|
|
452
|
+
type: "workflow.resumed";
|
|
453
|
+
state: string;
|
|
454
|
+
childRunId: string;
|
|
455
|
+
}
|
|
363
456
|
/**
|
|
364
457
|
* `child`: the run is waiting because this child run waits; events go to it.
|
|
365
458
|
* `title` and `body`: the wait step's description, filled in against the
|
|
@@ -397,13 +490,24 @@ export type RunEventBody = {
|
|
|
397
490
|
}
|
|
398
491
|
/**
|
|
399
492
|
* `reason`: why the run failed (requirement `events.run-failed-reason`); absent in older logs.
|
|
400
|
-
* `host`: with `model-unreachable` only, the host and port that didn't answer, such as
|
|
493
|
+
* `host`: with `model-unreachable` and `model-timeout` only, the host and port that didn't answer, such as
|
|
401
494
|
* `localhost:11434` (requirement `events.run-failed-model-unreachable`).
|
|
402
|
-
* `sandboxReason`: with `sandbox-not-ready
|
|
403
|
-
*
|
|
495
|
+
* `sandboxReason`: with `sandbox-not-ready`, and with `sandbox-start-failed` when the sandbox
|
|
496
|
+
* check no longer passed once the sandbox failed to open, why the sandbox can't start, as the
|
|
497
|
+
* `Sandbox` port's reason code, such as `bubblewrap-missing` (requirements
|
|
498
|
+
* `events.run-failed-sandbox-not-ready` and `events.run-failed-sandbox-start-failed`).
|
|
404
499
|
* A reader that doesn't know the code reads it as `other`.
|
|
500
|
+
* `harnessCause`: with `harness-start-failed` only, why the program didn't start when the engine
|
|
501
|
+
* knows, `not-installed` or `signed-out` (requirement `events.run-failed-harness-cause`).
|
|
502
|
+
* `agent`: with `sandbox-not-ready`, the agent that didn't start (requirement `events.run-failed-sandbox-not-ready`).
|
|
503
|
+
* `agent`, `pin` and `changed`: with `instructions-not-trusted`, the agent that didn't start,
|
|
504
|
+
* the digests of the instructions the check saw (never their text) and whether a person had
|
|
505
|
+
* trusted instructions for it before (requirement `events.run-failed-instructions-not-trusted`);
|
|
506
|
+
* absent in older logs. A reader that doesn't know the reason still shows `error`.
|
|
405
507
|
* `providerText`: the model provider's own error text, for `--debug` and Copy details only
|
|
406
508
|
* (requirement `events.provider-text`); absent in older logs and when it gave none.
|
|
509
|
+
* `cause`: the typed cause, from the error the failing call threw, when that error has a
|
|
510
|
+
* kind (requirement `events.run-failed-cause`); absent in older logs. A screen reads it, never `error`.
|
|
407
511
|
*/
|
|
408
512
|
| {
|
|
409
513
|
type: "run.failed";
|
|
@@ -412,7 +516,12 @@ export type RunEventBody = {
|
|
|
412
516
|
reason?: RunFailureReason;
|
|
413
517
|
host?: string;
|
|
414
518
|
sandboxReason?: string;
|
|
519
|
+
harnessCause?: HarnessStartCause;
|
|
520
|
+
agent?: string;
|
|
521
|
+
pin?: LoggedInstructionPin;
|
|
522
|
+
changed?: boolean;
|
|
415
523
|
providerText?: ProviderText;
|
|
524
|
+
cause?: RunFailureCause;
|
|
416
525
|
}
|
|
417
526
|
/**
|
|
418
527
|
* A Try it or Test run ended at a step it couldn't try, and nothing in it
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { RunEvent } from "./run-event.js";
|
|
2
|
+
import { type SendCount } from "./run-sends.js";
|
|
3
|
+
/**
|
|
4
|
+
* What a run read, worked out from its log by the reader rules of requirement
|
|
5
|
+
* `events.tool-result-risk`: one count per noun in the order of each noun's
|
|
6
|
+
* first call, for every `tool.result` with `risk: "read"`, a `noun` and
|
|
7
|
+
* `outcome: "ok"`. Pure; the receipt says "Read 3 emails" from it.
|
|
8
|
+
*
|
|
9
|
+
* @param events - the run's events, oldest first
|
|
10
|
+
* @returns the reads, noun by noun; empty when the run read nothing it can name
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* readsOf(events);
|
|
14
|
+
* // gmail_read_message twice, drive_get_file once => [2 emails, 1 Drive file]
|
|
15
|
+
*/
|
|
16
|
+
export declare function readsOf(events: readonly RunEvent[]): SendCount[];
|
|
17
|
+
/**
|
|
18
|
+
* What a run drafted: the ok calls of a write tool whose `verb` is
|
|
19
|
+
* "drafted", counted per noun like {@link readsOf}. A draft is not a send.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* draftsOf(events);
|
|
23
|
+
* // gmail_create_draft once => [1 email]
|
|
24
|
+
*/
|
|
25
|
+
export declare function draftsOf(events: readonly RunEvent[]): SendCount[];
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { countNoun } from "./run-sends.js";
|
|
2
|
+
/**
|
|
3
|
+
* What a run read, worked out from its log by the reader rules of requirement
|
|
4
|
+
* `events.tool-result-risk`: one count per noun in the order of each noun's
|
|
5
|
+
* first call, for every `tool.result` with `risk: "read"`, a `noun` and
|
|
6
|
+
* `outcome: "ok"`. Pure; the receipt says "Read 3 emails" from it.
|
|
7
|
+
*
|
|
8
|
+
* @param events - the run's events, oldest first
|
|
9
|
+
* @returns the reads, noun by noun; empty when the run read nothing it can name
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* readsOf(events);
|
|
13
|
+
* // gmail_read_message twice, drive_get_file once => [2 emails, 1 Drive file]
|
|
14
|
+
*/
|
|
15
|
+
export function readsOf(events) {
|
|
16
|
+
const counts = [];
|
|
17
|
+
for (const event of events) {
|
|
18
|
+
if (event.type !== "tool.result" || event.risk !== "read")
|
|
19
|
+
continue;
|
|
20
|
+
if (event.outcome !== "ok" || event.noun === undefined)
|
|
21
|
+
continue;
|
|
22
|
+
countNoun(counts, event.noun);
|
|
23
|
+
}
|
|
24
|
+
return counts;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* What a run drafted: the ok calls of a write tool whose `verb` is
|
|
28
|
+
* "drafted", counted per noun like {@link readsOf}. A draft is not a send.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* draftsOf(events);
|
|
32
|
+
* // gmail_create_draft once => [1 email]
|
|
33
|
+
*/
|
|
34
|
+
export function draftsOf(events) {
|
|
35
|
+
const counts = [];
|
|
36
|
+
for (const event of events) {
|
|
37
|
+
if (event.type !== "tool.result" || event.risk !== "write")
|
|
38
|
+
continue;
|
|
39
|
+
if (event.outcome !== "ok" || event.verb !== "drafted" || event.noun === undefined)
|
|
40
|
+
continue;
|
|
41
|
+
countNoun(counts, event.noun);
|
|
42
|
+
}
|
|
43
|
+
return counts;
|
|
44
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { ToolNoun, ToolVerb } from "./run-basics.js";
|
|
2
|
+
import type { RunEvent } from "./run-event.js";
|
|
3
|
+
/** How many calls did one verb to one noun, such as 2 calls that sent an email. */
|
|
4
|
+
export interface SendCount {
|
|
5
|
+
noun: ToolNoun;
|
|
6
|
+
calls: number;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* What one verb did, noun by noun, in the order of each noun's first call:
|
|
10
|
+
* "sent" with 1 email and 2 invites reads "sent 1 email and 2 invites".
|
|
11
|
+
*/
|
|
12
|
+
export interface SendGroup {
|
|
13
|
+
verb: ToolVerb;
|
|
14
|
+
counts: SendCount[];
|
|
15
|
+
}
|
|
16
|
+
/** What a run sent, worked out from its log by {@link sendsOf}. */
|
|
17
|
+
export interface RunSends {
|
|
18
|
+
/** The calls that sent, one group per verb, in the order of each verb's first call. */
|
|
19
|
+
sent: SendGroup[];
|
|
20
|
+
/** The calls that broke off without an answer, so may have sent; grouped the same way. */
|
|
21
|
+
maySend: SendGroup[];
|
|
22
|
+
/**
|
|
23
|
+
* Whether the run made a tool call at all. A run "sent nothing" only when
|
|
24
|
+
* it made none: a call whose log doesn't say what it can do may have sent.
|
|
25
|
+
* Starting a child run counts as a call, because the child may have sent.
|
|
26
|
+
*/
|
|
27
|
+
madeToolCalls: boolean;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* What a run sent, by the reader rules of requirement
|
|
31
|
+
* `events.tool-result-risk`. Pure; the receipt and the runs list both use it,
|
|
32
|
+
* so they say the same thing about a run.
|
|
33
|
+
*
|
|
34
|
+
* A call counts as sent when its `tool.result` has `risk: "send"`, a `noun`
|
|
35
|
+
* and `outcome: "ok"`, and as "may have sent" with `outcome: "unknown"`. A
|
|
36
|
+
* missing `verb` is "sent". Groups and the counts in them keep call order.
|
|
37
|
+
*
|
|
38
|
+
* @param events - the run's events, oldest first
|
|
39
|
+
* @returns what it sent, what it may have sent, and whether it made a tool call
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* const { sent } = sendsOf(await runStore.events(runId));
|
|
43
|
+
* // gmail_send, calendar_create_event twice, drive_create_file =>
|
|
44
|
+
* // [{ verb: "sent", counts: [1 email, 2 invites] }, { verb: "saved", counts: [1 file] }]
|
|
45
|
+
*/
|
|
46
|
+
export declare function sendsOf(events: readonly RunEvent[]): RunSends;
|
|
47
|
+
export declare function countNoun(counts: SendCount[], noun: ToolNoun): void;
|