humanish 0.111.4 → 0.113.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.
Files changed (158) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/README.md +11 -0
  3. package/TELEMETRY.md +21 -0
  4. package/dist/actors/codex/restricted-participant-policy.d.ts +21 -1
  5. package/dist/actors/codex/restricted-participant-policy.js +20 -2
  6. package/dist/actors/codex/restricted-participant.d.ts +1 -1
  7. package/dist/actors/codex/restricted-participant.js +2 -1
  8. package/dist/actors/computer-use/loop/debrief.d.ts +12 -4
  9. package/dist/actors/computer-use/loop/debrief.js +57 -20
  10. package/dist/actors/computer-use/loop/ending.d.ts +5 -2
  11. package/dist/actors/computer-use/loop/impressions.d.ts +14 -0
  12. package/dist/actors/computer-use/loop/impressions.js +40 -0
  13. package/dist/actors/computer-use/loop/session.d.ts +3 -1
  14. package/dist/actors/computer-use/loop/session.js +2 -0
  15. package/dist/actors/computer-use/loop/trace.js +2 -0
  16. package/dist/actors/computer-use/loop/types.d.ts +8 -1
  17. package/dist/actors/computer-use/loop.d.ts +2 -1
  18. package/dist/actors/computer-use/loop.js +15 -3
  19. package/dist/actors/computer-use/openai-conversation.d.ts +96 -0
  20. package/dist/actors/computer-use/openai-conversation.js +238 -0
  21. package/dist/actors/computer-use/openai-provider.js +38 -48
  22. package/dist/actors/contract.d.ts +45 -3
  23. package/dist/actors/contract.js +13 -0
  24. package/dist/analysis/diagnostics.js +7 -12
  25. package/dist/analysis/evidence-sources.d.ts +3 -1
  26. package/dist/analysis/evidence-sources.js +10 -1
  27. package/dist/analysis/evidence.js +2 -2
  28. package/dist/analysis/execute.d.ts +1 -1
  29. package/dist/analysis/execute.js +37 -5
  30. package/dist/analysis/service.js +7 -1
  31. package/dist/analysis/types.d.ts +23 -0
  32. package/dist/analysis/validation.d.ts +80 -35
  33. package/dist/analysis/validation.js +58 -11
  34. package/dist/cli/commands/runs.js +37 -20
  35. package/dist/cli/commands/setup.js +95 -6
  36. package/dist/cli/commands/study-format.js +7 -4
  37. package/dist/cli/commands/study.js +1 -1
  38. package/dist/cli/commands/tui.js +1 -1
  39. package/dist/cli/doctor.d.ts +2 -0
  40. package/dist/cli/doctor.js +18 -0
  41. package/dist/cli/findings.d.ts +34 -3
  42. package/dist/cli/findings.js +136 -18
  43. package/dist/cli/io.d.ts +4 -1
  44. package/dist/cli/io.js +3 -2
  45. package/dist/cli/program.js +35 -1
  46. package/dist/cli/secret-prompt.d.ts +5 -1
  47. package/dist/cli/secret-prompt.js +6 -2
  48. package/dist/cli/update-check-worker.d.ts +1 -0
  49. package/dist/cli/update-check-worker.js +5 -0
  50. package/dist/cli/update-check.d.ts +46 -0
  51. package/dist/cli/update-check.js +203 -0
  52. package/dist/feedback/draft.js +32 -4
  53. package/dist/keys/key-resolution.js +2 -0
  54. package/dist/keys/key-status.d.ts +37 -0
  55. package/dist/keys/key-status.js +68 -0
  56. package/dist/observer/run-routes.js +8 -4
  57. package/dist/observer-app.html +4 -4
  58. package/dist/routes/computer-use/bundle.d.ts +1 -1
  59. package/dist/routes/computer-use/bundle.js +6 -16
  60. package/dist/routes/computer-use/fanout-bundle.js +40 -37
  61. package/dist/routes/computer-use/fanout-records.d.ts +2 -0
  62. package/dist/routes/computer-use/fanout-records.js +18 -26
  63. package/dist/routes/computer-use/local-vm.js +9 -2
  64. package/dist/routes/computer-use/participant-desktop.d.ts +6 -0
  65. package/dist/routes/computer-use/participant-execution.js +13 -12
  66. package/dist/routes/computer-use/participant-facts.d.ts +2 -2
  67. package/dist/routes/computer-use/participant-facts.js +10 -1
  68. package/dist/routes/computer-use/rerun-selection.js +23 -21
  69. package/dist/routes/computer-use/result.js +10 -17
  70. package/dist/routes/computer-use/self-report.js +7 -1
  71. package/dist/routes/computer-use/setup.js +14 -0
  72. package/dist/routes/computer-use/single-bundle.d.ts +2 -0
  73. package/dist/routes/computer-use/single-bundle.js +81 -37
  74. package/dist/routes/computer-use/types.d.ts +4 -1
  75. package/dist/routes/scripted/bundle.d.ts +1 -1
  76. package/dist/routes/scripted/bundle.js +9 -19
  77. package/dist/routes/scripted/surface-records.d.ts +0 -1
  78. package/dist/routes/scripted/surface-records.js +27 -13
  79. package/dist/routes/shared-world/bundle-records.d.ts +2 -2
  80. package/dist/routes/shared-world/bundle-records.js +24 -30
  81. package/dist/routes/shared-world/bundle.d.ts +1 -1
  82. package/dist/routes/shared-world/bundle.js +71 -79
  83. package/dist/routes/shared-world/participant-specs.d.ts +1 -2
  84. package/dist/routes/shared-world/participant-specs.js +0 -8
  85. package/dist/routes/shared-world/result.js +8 -12
  86. package/dist/routes/terminal/bundle.d.ts +1 -1
  87. package/dist/routes/terminal/bundle.js +10 -19
  88. package/dist/routes/terminal/dry-run.js +1 -0
  89. package/dist/routes/terminal/live-sandbox.js +9 -2
  90. package/dist/routes/terminal/plan.js +1 -0
  91. package/dist/routes/terminal/runtime.d.ts +1 -0
  92. package/dist/routes/terminal/runtime.js +1 -0
  93. package/dist/routes/terminal/session.js +1 -0
  94. package/dist/run/costs.js +9 -20
  95. package/dist/run/detail.d.ts +1 -1
  96. package/dist/run/detail.js +13 -4
  97. package/dist/run/display.d.ts +2 -2
  98. package/dist/run/display.js +15 -18
  99. package/dist/run/dry-run.js +10 -25
  100. package/dist/run/judge.d.ts +24 -0
  101. package/dist/run/judge.js +54 -0
  102. package/dist/run/liveness.d.ts +18 -0
  103. package/dist/run/liveness.js +24 -0
  104. package/dist/run/outcomes.d.ts +8 -1
  105. package/dist/run/outcomes.js +58 -12
  106. package/dist/run/participant-caption.d.ts +31 -0
  107. package/dist/run/participant-caption.js +60 -0
  108. package/dist/run/participant-records.d.ts +4 -2
  109. package/dist/run/participant-records.js +6 -0
  110. package/dist/run/review-markdown.d.ts +11 -0
  111. package/dist/run/review-markdown.js +22 -0
  112. package/dist/run/run-cost.d.ts +7 -0
  113. package/dist/run/run-cost.js +25 -5
  114. package/dist/run/run-index.d.ts +4 -50
  115. package/dist/run/run-index.js +57 -87
  116. package/dist/run/run.d.ts +2 -2
  117. package/dist/run/run.js +5 -3
  118. package/dist/run/stats.js +2 -12
  119. package/dist/run/transient-comms-secrets.d.ts +8 -3
  120. package/dist/run/transient-comms-secrets.js +21 -1
  121. package/dist/run-study.js +17 -1
  122. package/dist/study/discover.js +6 -1
  123. package/dist/study/doctor.d.ts +2 -0
  124. package/dist/study/doctor.js +45 -7
  125. package/dist/study/init-templates.js +10 -5
  126. package/dist/study/keys.d.ts +1 -0
  127. package/dist/study/keys.js +1 -1
  128. package/dist/study/parse/execution.js +7 -1
  129. package/dist/study/plan-types.d.ts +1 -0
  130. package/dist/study/plan.js +3 -2
  131. package/dist/study/preflight-result.d.ts +1 -0
  132. package/dist/study/preflight-result.js +1 -1
  133. package/dist/study/preflight.d.ts +2 -0
  134. package/dist/study/preflight.js +54 -14
  135. package/dist/study/types.d.ts +4 -1
  136. package/dist/study/warnings.d.ts +7 -1
  137. package/dist/study/warnings.js +82 -4
  138. package/dist/substrates/local/capacity.d.ts +75 -0
  139. package/dist/substrates/local/capacity.js +143 -0
  140. package/dist/substrates/local/firecracker-desktop.d.ts +8 -0
  141. package/dist/substrates/local/firecracker-desktop.js +34 -3
  142. package/dist/substrates/local/runtime-host.d.ts +16 -3
  143. package/dist/substrates/local/runtime-host.js +49 -4
  144. package/dist/substrates/local/runtime.d.ts +10 -0
  145. package/dist/substrates/local/runtime.js +44 -5
  146. package/dist/tui-app.js +75 -75
  147. package/dist/verify/liveness.d.ts +2 -2
  148. package/dist/verify/liveness.js +7 -4
  149. package/docs/architecture/actor-contract.md +20 -6
  150. package/docs/architecture/terminal-product-route.md +14 -0
  151. package/docs/contracts/feedback.md +8 -1
  152. package/docs/contracts/run-bundle.md +10 -0
  153. package/docs/contracts/schemas.md +65 -34
  154. package/docs/contracts/study-analysis.md +86 -22
  155. package/package.json +2 -1
  156. package/skills/humanish/SKILL.md +21 -10
  157. package/dist/actors/computer-use/openai-requests.d.ts +0 -62
  158. package/dist/actors/computer-use/openai-requests.js +0 -144
@@ -1,62 +0,0 @@
1
- import type { CuaTurnRequest } from "./loop.js";
2
- import type { ReasoningEffort } from "../reasoning-effort.js";
3
- import type { ActorConversation } from "../contract.js";
4
- import { CarriedConversation } from "./openai-context.js";
5
- import { type OpenAiReasoningSummary, type ParsedOpenAiResponse } from "./openai-wire.js";
6
- /** Request settings fixed for a provider's whole session. */
7
- export interface OpenAiRequestSettings {
8
- readonly model: string;
9
- readonly reasoningEffort: ReasoningEffort;
10
- readonly maxOutputTokens?: number;
11
- readonly safetyIdentifier?: string;
12
- }
13
- /** The conversation as the provider has it after its last accepted reply. */
14
- export interface OpenAiConversationState {
15
- lastResponseId: string | undefined;
16
- /** computer_call ids the next request owes an output for. */
17
- pendingCallIds: string[];
18
- /** Accepted replies so far; the next request is number `replies + 1`. */
19
- replies: number;
20
- /** The whole conversation, which explicit-context requests carry within its token budget. */
21
- conversation: CarriedConversation;
22
- /** explicit_context after a zero-data-retention rejection or when configured. */
23
- mode: "previous_response_id" | "explicit_context";
24
- /** Undefined once the account or model rejected reasoning summaries. */
25
- reasoningSummary: OpenAiReasoningSummary | undefined;
26
- }
27
- /**
28
- * The items the next request adds to the conversation: the opening message with the first
29
- * screen, or an output for each pending computer_call with the latest screenshot and any hint.
30
- * Built once per turn, so every attempt at the request and the accepted reply see the same items.
31
- */
32
- export declare function turnInputItems(state: OpenAiConversationState, req: CuaTurnRequest): readonly unknown[];
33
- /**
34
- * The body of the next participant request: the opening request, or a continuation carrying
35
- * `sent` (turnInputItems). A threaded continuation names the previous response; an
36
- * explicit-context one carries the conversation ahead of `sent`.
37
- */
38
- export declare function turnRequestBody(settings: OpenAiRequestSettings, state: OpenAiConversationState, req: CuaTurnRequest, sent: readonly unknown[]): Record<string, unknown>;
39
- /** The body of the read-only closing report: no tools, a small output limit, a strict schema. */
40
- export declare function debriefRequestBody(settings: OpenAiRequestSettings, state: OpenAiConversationState, req: CuaTurnRequest, sent: readonly unknown[]): Record<string, unknown>;
41
- /**
42
- * Move the conversation on to an accepted reply to a request that added `sent`. A participant
43
- * reply cut off by the output limit is set aside, so the next request is the same one again
44
- * (outputLimitRetry); its actions never run, so no call output is owed for them.
45
- */
46
- export declare function acceptReply(state: OpenAiConversationState, parsed: ParsedOpenAiResponse, closing: boolean, sent: readonly unknown[]): void;
47
- /** The trace's account of how a session carried its conversation (ActorConversation). */
48
- export declare class ConversationRecord {
49
- private readonly now;
50
- private explicitReason;
51
- private rejection;
52
- private switchedAt;
53
- private switchedAtRequest;
54
- private summarizedTurns;
55
- private readonly requests;
56
- constructor(configured: boolean, now: () => number);
57
- /** The organization rejected server-side state, so the request being sent is explicit_context. */
58
- switched(rejection: NonNullable<ActorConversation["rejection"]>): void;
59
- /** A participant request just went out with `sent` after the carried conversation. */
60
- requested(state: OpenAiConversationState, sent: readonly unknown[]): void;
61
- snapshot(state: OpenAiConversationState): ActorConversation;
62
- }
@@ -1,144 +0,0 @@
1
- import { CarriedConversation, estimateTokens } from "./openai-context.js";
2
- import { buildCallOutput, buildContinuationRequest, buildInitialRequest, hintItems, openingMessage, } from "./openai-wire.js";
3
- /** The closing report's output limit: its own cap, or the declared limit when that is lower. */
4
- const CLOSING_OUTPUT_LIMIT = 1024;
5
- function requestContext(settings, state, instructions) {
6
- return {
7
- stateless: state.mode === "explicit_context",
8
- model: settings.model,
9
- instructions,
10
- reasoningEffort: settings.reasoningEffort,
11
- ...(settings.maxOutputTokens === undefined
12
- ? {}
13
- : { maxOutputTokens: settings.maxOutputTokens }),
14
- ...(state.reasoningSummary === undefined ? {} : { reasoningSummary: state.reasoningSummary }),
15
- ...(settings.safetyIdentifier === undefined
16
- ? {}
17
- : { safetyIdentifier: settings.safetyIdentifier }),
18
- };
19
- }
20
- /** No reply has been accepted yet, so the next request opens the conversation. */
21
- function isFirstTurn(state) {
22
- return state.replies === 0;
23
- }
24
- /**
25
- * The items the next request adds to the conversation: the opening message with the first
26
- * screen, or an output for each pending computer_call with the latest screenshot and any hint.
27
- * Built once per turn, so every attempt at the request and the accepted reply see the same items.
28
- */
29
- export function turnInputItems(state, req) {
30
- if (isFirstTurn(state))
31
- return [openingMessage(req.instructions, req.observation.screenshot)];
32
- return [
33
- ...state.pendingCallIds.map((id) => buildCallOutput(id, req.observation.screenshot, req.acknowledgedSafetyChecks)),
34
- ...hintItems(req.contextHint),
35
- ];
36
- }
37
- /**
38
- * The body of the next participant request: the opening request, or a continuation carrying
39
- * `sent` (turnInputItems). A threaded continuation names the previous response; an
40
- * explicit-context one carries the conversation ahead of `sent`.
41
- */
42
- export function turnRequestBody(settings, state, req, sent) {
43
- const ctx = requestContext(settings, state, req.instructions);
44
- if (isFirstTurn(state))
45
- return buildInitialRequest(ctx, req.observation.screenshot);
46
- return buildContinuationRequest({
47
- ctx,
48
- previousResponseId: state.lastResponseId,
49
- callOutputs: [...sent],
50
- ...(state.mode === "explicit_context"
51
- ? { explicitContextItems: state.conversation.carried() }
52
- : {}),
53
- });
54
- }
55
- /** The body of the read-only closing report: no tools, a small output limit, a strict schema. */
56
- export function debriefRequestBody(settings, state, req, sent) {
57
- return {
58
- ...turnRequestBody(settings, state, req, sent),
59
- tool_choice: "none",
60
- max_output_tokens: Math.min(settings.maxOutputTokens ?? CLOSING_OUTPUT_LIMIT, CLOSING_OUTPUT_LIMIT),
61
- text: {
62
- format: {
63
- type: "json_schema",
64
- name: "participant_closing_report",
65
- strict: true,
66
- schema: {
67
- type: "object",
68
- additionalProperties: false,
69
- required: ["summary", "frictionReports"],
70
- properties: {
71
- summary: { type: "string" },
72
- frictionReports: { type: "array", items: { type: "string" } },
73
- },
74
- },
75
- },
76
- },
77
- };
78
- }
79
- /**
80
- * Move the conversation on to an accepted reply to a request that added `sent`. A participant
81
- * reply cut off by the output limit is set aside, so the next request is the same one again
82
- * (outputLimitRetry); its actions never run, so no call output is owed for them.
83
- */
84
- export function acceptReply(state, parsed, closing, sent) {
85
- if (!closing && parsed.turn.interruption === "output_limit")
86
- return;
87
- if (parsed.turn.responseId !== undefined)
88
- state.lastResponseId = parsed.turn.responseId;
89
- state.pendingCallIds = parsed.callIds;
90
- state.replies += 1;
91
- state.conversation.accept(state.replies, sent, parsed.outputItems);
92
- }
93
- /** The trace's account of how a session carried its conversation (ActorConversation). */
94
- export class ConversationRecord {
95
- now;
96
- explicitReason;
97
- rejection;
98
- switchedAt;
99
- switchedAtRequest;
100
- summarizedTurns = 0;
101
- requests = [];
102
- constructor(configured, now) {
103
- this.now = now;
104
- if (configured)
105
- this.explicitReason = "configured";
106
- }
107
- /** The organization rejected server-side state, so the request being sent is explicit_context. */
108
- switched(rejection) {
109
- this.explicitReason = "zdr_rejection";
110
- this.rejection = rejection;
111
- this.switchedAt = new Date(this.now()).toISOString();
112
- // Counted like requests[], which includes replies set aside at their output limit.
113
- this.switchedAtRequest = this.requests.length + 1;
114
- }
115
- /** A participant request just went out with `sent` after the carried conversation. */
116
- requested(state, sent) {
117
- if (state.mode !== "explicit_context") {
118
- this.requests.push({ mode: "threaded" });
119
- return;
120
- }
121
- const carried = state.conversation.size();
122
- // Only summaries a request carried count; the conversation also trims after the last reply.
123
- this.summarizedTurns = carried.notedTurns;
124
- this.requests.push({
125
- mode: "explicit_context",
126
- carriedExchanges: carried.exchanges,
127
- carriedScreenshots: carried.screenshots,
128
- estimatedInputTokens: carried.estimatedTokens + estimateTokens(sent),
129
- });
130
- }
131
- snapshot(state) {
132
- return {
133
- mode: state.mode === "explicit_context" ? "explicit_context" : "threaded",
134
- ...(this.explicitReason === undefined ? {} : { explicitReason: this.explicitReason }),
135
- ...(this.rejection === undefined ? {} : { rejection: this.rejection }),
136
- ...(this.switchedAt === undefined ? {} : { switchedAt: this.switchedAt }),
137
- ...(this.switchedAtRequest === undefined
138
- ? {}
139
- : { switchedAtRequest: this.switchedAtRequest }),
140
- summarizedTurns: this.summarizedTurns,
141
- requests: this.requests.map((request) => ({ ...request })),
142
- };
143
- }
144
- }