@capybara-hq/kernel 0.1.0-rc.106 → 0.1.0-rc.107
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/admin/admin.schemas.d.ts +3 -0
- package/dist/catalog/marketplaces.service.d.ts +1 -1
- package/dist/channels/channels.module.js +4 -3
- package/dist/channels/file-delivery.d.ts +26 -11
- package/dist/channels/file-delivery.js +32 -11
- package/dist/channels/outbound.d.ts +3 -3
- package/dist/channels/outbound.js +15 -13
- package/dist/config/schema.d.ts +3 -0
- package/dist/config/schema.js +12 -0
- package/dist/conversations/artifacts.d.ts +20 -17
- package/dist/conversations/artifacts.js +30 -37
- package/dist/conversations/attachments.controller.d.ts +6 -19
- package/dist/conversations/attachments.controller.js +8 -59
- package/dist/conversations/attachments.service.d.ts +30 -74
- package/dist/conversations/attachments.service.js +51 -193
- package/dist/conversations/conversations.module.js +4 -0
- package/dist/conversations/conversations.service.d.ts +10 -9
- package/dist/conversations/conversations.service.js +28 -11
- package/dist/conversations/event-log.d.ts +1 -0
- package/dist/conversations/events.d.ts +49 -27
- package/dist/conversations/events.js +54 -7
- package/dist/conversations/files.d.ts +66 -64
- package/dist/conversations/files.js +127 -147
- package/dist/conversations/prompt-suggestion-request.js +2 -1
- package/dist/conversations/prompt-suggestions.d.ts +3 -3
- package/dist/conversations/prompt-suggestions.js +11 -10
- package/dist/conversations/queue.service.js +7 -2
- package/dist/ctx/create-ctx.d.ts +3 -1
- package/dist/ctx/create-ctx.js +19 -1
- package/dist/db/kernel-schema.d.ts +80 -2
- package/dist/errors.d.ts +19 -0
- package/dist/errors.js +19 -0
- package/dist/evals/canonical-json.d.ts +7 -0
- package/dist/evals/canonical-json.js +21 -0
- package/dist/evals/reconstruct.js +13 -1
- package/dist/evals/recorded-tools.d.ts +0 -2
- package/dist/evals/recorded-tools.js +1 -16
- package/dist/evals/snapshot.d.ts +26 -3
- package/dist/evals/snapshot.js +110 -57
- package/dist/evals/worker.d.ts +4 -3
- package/dist/evals/worker.js +8 -4
- package/dist/extensions/host.d.ts +3 -1
- package/dist/extensions/host.js +2 -0
- package/dist/extensions/instance.d.ts +3 -1
- package/dist/extensions/instance.js +4 -0
- package/dist/extensions/ledger.d.ts +1 -1
- package/dist/files/blob-objects.d.ts +124 -0
- package/dist/files/blob-objects.js +341 -0
- package/dist/files/blob-sweep.job.d.ts +122 -0
- package/dist/files/blob-sweep.job.js +389 -0
- package/dist/files/blobs.service.d.ts +135 -0
- package/dist/files/blobs.service.js +300 -0
- package/dist/files/conversation-media.d.ts +41 -0
- package/dist/files/conversation-media.js +124 -0
- package/dist/files/deliveries.d.ts +64 -0
- package/dist/files/deliveries.js +156 -0
- package/dist/files/deliveries.module.d.ts +6 -0
- package/dist/files/deliveries.module.js +24 -0
- package/dist/files/draft-cleanup.job.d.ts +26 -0
- package/dist/files/draft-cleanup.job.js +93 -0
- package/dist/files/files.module.d.ts +1 -1
- package/dist/files/files.module.js +3 -2
- package/dist/files/hash-job.d.ts +127 -0
- package/dist/files/hash-job.js +447 -0
- package/dist/files/library-backfill.d.ts +63 -0
- package/dist/files/library-backfill.js +143 -0
- package/dist/files/library-files.service.d.ts +255 -0
- package/dist/files/library-files.service.js +883 -0
- package/dist/files/library-jobs.module.d.ts +8 -0
- package/dist/files/library-jobs.module.js +27 -0
- package/dist/files/library-query.d.ts +127 -0
- package/dist/files/library-query.js +322 -0
- package/dist/files/library-read.module.d.ts +9 -0
- package/dist/files/library-read.module.js +30 -0
- package/dist/files/library.controller.d.ts +77 -0
- package/dist/files/library.controller.js +235 -0
- package/dist/files/library.module.d.ts +9 -0
- package/dist/files/library.module.js +29 -0
- package/dist/files/library.schemas.d.ts +46 -0
- package/dist/files/library.schemas.js +49 -0
- package/dist/files/previewers.controller.d.ts +20 -0
- package/dist/files/previewers.controller.js +47 -0
- package/dist/files/previewers.d.ts +25 -11
- package/dist/files/previewers.js +43 -27
- package/dist/files/referenced-files.d.ts +150 -0
- package/dist/files/referenced-files.js +234 -0
- package/dist/html/html-document.controller.d.ts +8 -1
- package/dist/html/html-document.controller.js +19 -1
- package/dist/html/html-document.service.d.ts +19 -4
- package/dist/html/html-document.service.js +43 -22
- package/dist/html/html-token.d.ts +10 -1
- package/dist/html/html-token.js +14 -0
- package/dist/html/html.module.js +8 -1
- package/dist/http/api.module.js +5 -0
- package/dist/identity/settings.d.ts +26 -0
- package/dist/identity/settings.js +33 -2
- package/dist/infra/outbox/registry.d.ts +82 -0
- package/dist/infra/outbox/registry.js +74 -2
- package/dist/infra/throttler/named-throttlers.d.ts +2 -0
- package/dist/infra/throttler/named-throttlers.js +14 -0
- package/dist/lifecycle/kernel-lifecycle.js +6 -0
- package/dist/models/purposes.js +1 -1
- package/dist/orgs/offboarding.js +1 -1
- package/dist/orgs/settings.service.d.ts +48 -2
- package/dist/orgs/settings.service.js +63 -3
- package/dist/platform/exclusions.js +45 -8
- package/dist/platform/file-ref.d.ts +18 -3
- package/dist/platform/file-ref.js +22 -11
- package/dist/platform/operation.js +4 -0
- package/dist/platform/ops/admin.ops.js +5 -2
- package/dist/platform/ops/files.ops.d.ts +18 -0
- package/dist/platform/ops/files.ops.js +267 -0
- package/dist/platform/ops/org-settings.ops.js +6 -2
- package/dist/platform/ops/orgs.ops.js +1 -0
- package/dist/platform/ops/shares.ops.js +2 -2
- package/dist/platform/platform-ops.module.d.ts +2 -1
- package/dist/platform/platform-ops.module.js +5 -0
- package/dist/platform/route-schemas.js +3 -0
- package/dist/roles/worker.module.js +15 -1
- package/dist/runtime/compaction-settings.service.d.ts +13 -1
- package/dist/runtime/compaction-settings.service.js +16 -1
- package/dist/runtime/compaction.service.d.ts +3 -1
- package/dist/runtime/compaction.service.js +3 -1
- package/dist/runtime/context/build.d.ts +18 -1
- package/dist/runtime/context/build.js +19 -8
- package/dist/runtime/context/cache-expiry.d.ts +31 -0
- package/dist/runtime/context/cache-expiry.js +60 -0
- package/dist/runtime/context/cache-ttl.d.ts +18 -0
- package/dist/runtime/context/cache-ttl.js +30 -0
- package/dist/runtime/context/compaction.d.ts +9 -2
- package/dist/runtime/context/compaction.js +50 -17
- package/dist/runtime/context/in-context-compaction.d.ts +156 -0
- package/dist/runtime/context/in-context-compaction.js +310 -0
- package/dist/runtime/hook-calls.d.ts +2 -1
- package/dist/runtime/hook-calls.js +5 -2
- package/dist/runtime/maintenance.d.ts +10 -2
- package/dist/runtime/maintenance.js +48 -8
- package/dist/runtime/model-call.d.ts +34 -5
- package/dist/runtime/model-call.js +207 -22
- package/dist/runtime/providers.js +11 -1
- package/dist/runtime/run-steps.d.ts +4 -2
- package/dist/runtime/run-steps.js +10 -5
- package/dist/runtime/runtime.module.js +3 -0
- package/dist/shares/liveness.d.ts +26 -12
- package/dist/shares/liveness.js +79 -20
- package/dist/shares/revoke.d.ts +16 -11
- package/dist/shares/revoke.js +18 -14
- package/dist/shares/share-objects.d.ts +16 -21
- package/dist/shares/share-objects.js +25 -55
- package/dist/shares/share-open.service.d.ts +8 -4
- package/dist/shares/share-open.service.js +14 -11
- package/dist/shares/shares.controller.d.ts +16 -5
- package/dist/shares/shares.controller.js +39 -5
- package/dist/shares/shares.module.d.ts +4 -4
- package/dist/shares/shares.module.js +7 -6
- package/dist/shares/shares.schemas.d.ts +4 -0
- package/dist/shares/shares.schemas.js +2 -0
- package/dist/shares/shares.service.d.ts +93 -54
- package/dist/shares/shares.service.js +292 -131
- package/dist/shares/sweep.job.d.ts +18 -39
- package/dist/shares/sweep.job.js +47 -206
- package/dist/tools/builtins/artifacts.d.ts +21 -13
- package/dist/tools/builtins/artifacts.js +81 -51
- package/dist/tools/builtins/builtin-tools.d.ts +7 -1
- package/dist/tools/builtins/builtin-tools.js +17 -6
- package/dist/tools/builtins/conversation-files.d.ts +23 -13
- package/dist/tools/builtins/conversation-files.js +62 -83
- package/dist/tools/builtins/image/generate.d.ts +7 -1
- package/dist/tools/builtins/image/generate.js +1 -1
- package/dist/tools/builtins/platform.js +1 -0
- package/dist/tools/builtins/sandbox/common.d.ts +6 -2
- package/dist/tools/builtins/sandbox/deliver.js +6 -7
- package/dist/tools/builtins/sandbox/fetch-attachment.d.ts +6 -5
- package/dist/tools/builtins/sandbox/fetch-attachment.js +19 -12
- package/dist/tools/tools.module.js +6 -0
- package/dist/ui/call-extension.d.ts +6 -4
- package/dist/ui/call-extension.js +5 -4
- package/dist/ui/embed-token.js +6 -3
- package/dist/ui/registry.d.ts +21 -5
- package/dist/ui/registry.js +24 -6
- package/dist/ui/ui.schemas.d.ts +22 -0
- package/dist/ui/ui.schemas.js +22 -4
- package/dist/ui/views.controller.d.ts +13 -3
- package/dist/ui/views.controller.js +33 -2
- package/dist/ui/views.d.ts +29 -1
- package/dist/ui/views.js +131 -7
- package/package.json +3 -3
- package/src/migrations/0190_file_library.sql +285 -0
- package/src/migrations/0191_file_library_copy.sql +4 -0
|
@@ -1567,7 +1567,77 @@ export interface AutomationsTable {
|
|
|
1567
1567
|
unattended_ask: ColumnType<AutomationUnattendedAsk | null, AutomationUnattendedAsk | null | undefined, AutomationUnattendedAsk | null>;
|
|
1568
1568
|
}
|
|
1569
1569
|
/** Why a file share was revoked (0161). */
|
|
1570
|
-
export type FileShareRevokeReason = "creator" | "admin" | "conversation_deleted" | "member_offboarded" | "creator_lost_access"
|
|
1570
|
+
export type FileShareRevokeReason = "creator" | "admin" | "conversation_deleted" | "member_offboarded" | "creator_lost_access"
|
|
1571
|
+
/** 0190: the library file the share was made from was deleted. */
|
|
1572
|
+
| "file_deleted";
|
|
1573
|
+
/** 0190: a blob's state; `gone` = the hashing job found its object missing. */
|
|
1574
|
+
export type BlobStatus = "pending" | "ready" | "deleting" | "gone";
|
|
1575
|
+
/**
|
|
1576
|
+
* 0190 (file library spec §1): the bytes, content-addressed per org. `object_key` is relative to
|
|
1577
|
+
* `kernel/<org>/`; `sha256` is null only for a migrated blob not hashed yet.
|
|
1578
|
+
*/
|
|
1579
|
+
export interface BlobsTable {
|
|
1580
|
+
id: string;
|
|
1581
|
+
org_id: string;
|
|
1582
|
+
sha256: NullableText;
|
|
1583
|
+
/** bigint: pg returns it as a string. */
|
|
1584
|
+
size: Int8;
|
|
1585
|
+
etag: NullableText;
|
|
1586
|
+
object_key: string;
|
|
1587
|
+
status: BlobStatus;
|
|
1588
|
+
/** From when another account's upload may resolve to this blob. */
|
|
1589
|
+
dedup_after: Ts;
|
|
1590
|
+
created_at: Ts;
|
|
1591
|
+
}
|
|
1592
|
+
/** 0190: where a library file came from. */
|
|
1593
|
+
export type FileOrigin = "upload" | "delivered" | "generated";
|
|
1594
|
+
/** 0190: `uploading` (presigned, not finalized), `draft` (finalized, not sent), `ready`, `deleted`. */
|
|
1595
|
+
export type FileStatus = "uploading" | "draft" | "ready" | "deleted";
|
|
1596
|
+
/**
|
|
1597
|
+
* 0190 (file library spec §1): a file a person sees, owned by an account. `blob_id` is null while
|
|
1598
|
+
* `uploading` (and may be once `deleted`); `staging_key` is a migrated `uploading` row's old staging key (null for new
|
|
1599
|
+
* rows, which stage at `uploads/<id>`); `agent_id` has no foreign key (a label).
|
|
1600
|
+
*/
|
|
1601
|
+
export interface FilesTable {
|
|
1602
|
+
id: string;
|
|
1603
|
+
org_id: string;
|
|
1604
|
+
account_id: string;
|
|
1605
|
+
blob_id: NullableText;
|
|
1606
|
+
name: string;
|
|
1607
|
+
content_type: string;
|
|
1608
|
+
/** bigint: pg returns it as a string. */
|
|
1609
|
+
size: Int8;
|
|
1610
|
+
pages: ColumnType<number | null, number | null | undefined, number | null>;
|
|
1611
|
+
origin: FileOrigin;
|
|
1612
|
+
status: FileStatus;
|
|
1613
|
+
agent_id: NullableText;
|
|
1614
|
+
source_conversation_id: NullableText;
|
|
1615
|
+
source_path: NullableText;
|
|
1616
|
+
staging_key: NullableText;
|
|
1617
|
+
/** An upload's declared sha256 at create, the verified one from finalize on; null otherwise. */
|
|
1618
|
+
sha256: NullableText;
|
|
1619
|
+
/** Where an upload was started; null for deliveries and migrated rows. */
|
|
1620
|
+
upload_purpose: ColumnType<"composer" | "library" | null, "composer" | "library" | null | undefined, "composer" | "library" | null>;
|
|
1621
|
+
/**
|
|
1622
|
+
* The key and etag of the blob the file was first stored on: the model-visible reference stays
|
|
1623
|
+
* the same after the file moves to another blob. With `ref_key` set, `ref_etag` is as recorded.
|
|
1624
|
+
*/
|
|
1625
|
+
ref_key: NullableText;
|
|
1626
|
+
ref_etag: NullableText;
|
|
1627
|
+
expires_at: NullableTs;
|
|
1628
|
+
created_at: Ts;
|
|
1629
|
+
deleted_at: NullableTs;
|
|
1630
|
+
}
|
|
1631
|
+
/** 0190: which conversation refers to which file; `first_seq` the event that first referred to it. */
|
|
1632
|
+
export interface ConversationFilesTable {
|
|
1633
|
+
conversation_id: string;
|
|
1634
|
+
file_id: string;
|
|
1635
|
+
org_id: string;
|
|
1636
|
+
role: "attached" | "delivered";
|
|
1637
|
+
/** bigint: pg returns it as a string; null when not known (migrated rows). */
|
|
1638
|
+
first_seq: ColumnType<string | null, number | string | null | undefined, number | string | null>;
|
|
1639
|
+
created_at: Ts;
|
|
1640
|
+
}
|
|
1571
1641
|
/** 0164: the platform icon of one purpose (mobile layout spec §10.2.1); no row: the default. */
|
|
1572
1642
|
export interface PlatformIconsTable {
|
|
1573
1643
|
purpose: "app" | "maskable" | "favicon";
|
|
@@ -1585,7 +1655,8 @@ export interface FileSharesTable {
|
|
|
1585
1655
|
id: string;
|
|
1586
1656
|
org_id: string;
|
|
1587
1657
|
code: string;
|
|
1588
|
-
|
|
1658
|
+
/** 0190: null for a share made from the library (no conversation). */
|
|
1659
|
+
conversation_id: NullableText;
|
|
1589
1660
|
file_id: string;
|
|
1590
1661
|
source_path: NullableText;
|
|
1591
1662
|
created_by: string;
|
|
@@ -1603,6 +1674,10 @@ export interface FileSharesTable {
|
|
|
1603
1674
|
last_opened_at: NullableTs;
|
|
1604
1675
|
created_at: Ts;
|
|
1605
1676
|
updated_at: Ts;
|
|
1677
|
+
/** 0190: the blob holding the snapshot (replaces `object_key`). */
|
|
1678
|
+
blob_id: NullableText;
|
|
1679
|
+
/** 0190: the library file the share was made from, when it still exists. */
|
|
1680
|
+
source_file_id: NullableText;
|
|
1606
1681
|
}
|
|
1607
1682
|
/**
|
|
1608
1683
|
* 0113 (renamed in 0188 from the scheduled task runs table): one tick, event fire (0189) or trial
|
|
@@ -1853,6 +1928,9 @@ export interface KernelDatabase {
|
|
|
1853
1928
|
automation_event_deliveries: AutomationEventDeliveriesTable;
|
|
1854
1929
|
automation_conversations: AutomationConversationsTable;
|
|
1855
1930
|
file_shares: FileSharesTable;
|
|
1931
|
+
blobs: BlobsTable;
|
|
1932
|
+
files: FilesTable;
|
|
1933
|
+
conversation_files: ConversationFilesTable;
|
|
1856
1934
|
platform_icons: PlatformIconsTable;
|
|
1857
1935
|
skills: SkillsTable;
|
|
1858
1936
|
skill_versions: SkillVersionsTable;
|
package/dist/errors.d.ts
CHANGED
|
@@ -80,6 +80,8 @@ export declare const ERROR_CODES: {
|
|
|
80
80
|
* the Platform tool (only a person turns it on).
|
|
81
81
|
*/
|
|
82
82
|
readonly "org.external_sharing_not_allowed": 400;
|
|
83
|
+
/** An org's navigation setting puts more than 3 plugin pages in the primary navigation. */
|
|
84
|
+
readonly "org_settings.nav_primary_limit": 400;
|
|
83
85
|
/** A deployment setting set in the startup config (file, Nacos or env): read-only in the admin console. */
|
|
84
86
|
readonly "deployment.setting_readonly": 409;
|
|
85
87
|
/** Allowing outside-sandbox runs platform-wide through an API token or the Platform tool (only off). */
|
|
@@ -452,12 +454,29 @@ export declare const ERROR_CODES: {
|
|
|
452
454
|
readonly "ui.action_failed": 502;
|
|
453
455
|
readonly "ui.invalid_view": 502;
|
|
454
456
|
readonly "ui.timeout": 504;
|
|
457
|
+
/** A component query's params are over `UI_LIMITS.componentQueryParamsBytes` as JSON. */
|
|
458
|
+
readonly "ui.query_params_too_large": 413;
|
|
459
|
+
/** A component query's result is over `UI_LIMITS.componentQueryBytes` as JSON, or not JSON. */
|
|
460
|
+
readonly "ui.query_result_too_large": 502;
|
|
461
|
+
/** A component query did not answer within 10 seconds (its signal aborted). */
|
|
462
|
+
readonly "ui.query_timeout": 504;
|
|
463
|
+
/** A component query handler threw. */
|
|
464
|
+
readonly "ui.query_failed": 502;
|
|
465
|
+
/** No query handler for that component, or the component is not offered to the caller. */
|
|
466
|
+
readonly "ui.query_not_found": 404;
|
|
455
467
|
readonly "storage.unavailable": 503;
|
|
456
468
|
readonly "attachment.not_found": 404;
|
|
457
469
|
readonly "attachment.not_ready": 409;
|
|
458
470
|
readonly "attachment.too_large": 413;
|
|
459
471
|
readonly "attachment.type_not_allowed": 415;
|
|
460
472
|
readonly "attachment.too_many_pending": 429;
|
|
473
|
+
readonly "file.not_found": 404;
|
|
474
|
+
readonly "file.not_ready": 409;
|
|
475
|
+
readonly "file.hash_mismatch": 422;
|
|
476
|
+
readonly "file.deleted": 410;
|
|
477
|
+
readonly "file.too_large": 413;
|
|
478
|
+
readonly "file.type_not_allowed": 415;
|
|
479
|
+
readonly "file.too_many_pending": 429;
|
|
461
480
|
readonly "sandbox.unavailable": 503;
|
|
462
481
|
readonly "sandbox.busy": 409;
|
|
463
482
|
/** A cloud sandbox provider refused an instance with the open public network. */
|
package/dist/errors.js
CHANGED
|
@@ -80,6 +80,8 @@ export const ERROR_CODES = {
|
|
|
80
80
|
* the Platform tool (only a person turns it on).
|
|
81
81
|
*/
|
|
82
82
|
"org.external_sharing_not_allowed": 400,
|
|
83
|
+
/** An org's navigation setting puts more than 3 plugin pages in the primary navigation. */
|
|
84
|
+
"org_settings.nav_primary_limit": 400,
|
|
83
85
|
/** A deployment setting set in the startup config (file, Nacos or env): read-only in the admin console. */
|
|
84
86
|
"deployment.setting_readonly": 409,
|
|
85
87
|
/** Allowing outside-sandbox runs platform-wide through an API token or the Platform tool (only off). */
|
|
@@ -452,12 +454,29 @@ export const ERROR_CODES = {
|
|
|
452
454
|
"ui.action_failed": 502,
|
|
453
455
|
"ui.invalid_view": 502,
|
|
454
456
|
"ui.timeout": 504,
|
|
457
|
+
/** A component query's params are over `UI_LIMITS.componentQueryParamsBytes` as JSON. */
|
|
458
|
+
"ui.query_params_too_large": 413,
|
|
459
|
+
/** A component query's result is over `UI_LIMITS.componentQueryBytes` as JSON, or not JSON. */
|
|
460
|
+
"ui.query_result_too_large": 502,
|
|
461
|
+
/** A component query did not answer within 10 seconds (its signal aborted). */
|
|
462
|
+
"ui.query_timeout": 504,
|
|
463
|
+
/** A component query handler threw. */
|
|
464
|
+
"ui.query_failed": 502,
|
|
465
|
+
/** No query handler for that component, or the component is not offered to the caller. */
|
|
466
|
+
"ui.query_not_found": 404,
|
|
455
467
|
"storage.unavailable": 503,
|
|
456
468
|
"attachment.not_found": 404,
|
|
457
469
|
"attachment.not_ready": 409,
|
|
458
470
|
"attachment.too_large": 413,
|
|
459
471
|
"attachment.type_not_allowed": 415,
|
|
460
472
|
"attachment.too_many_pending": 429,
|
|
473
|
+
"file.not_found": 404,
|
|
474
|
+
"file.not_ready": 409,
|
|
475
|
+
"file.hash_mismatch": 422,
|
|
476
|
+
"file.deleted": 410,
|
|
477
|
+
"file.too_large": 413,
|
|
478
|
+
"file.type_not_allowed": 415,
|
|
479
|
+
"file.too_many_pending": 429,
|
|
461
480
|
"sandbox.unavailable": 503,
|
|
462
481
|
"sandbox.busy": 409,
|
|
463
482
|
/** A cloud sandbox provider refused an instance with the open public network. */
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical JSON (eval replay matching): object keys sorted recursively by code point, arrays in
|
|
3
|
+
* order, `undefined` left out by the JSON rules. A leaf module, so request building
|
|
4
|
+
* (`evals/reconstruct.ts`, reached from the runtime through the in-context summary) does not pull
|
|
5
|
+
* in the tool pipeline that `recorded-tools.ts` needs.
|
|
6
|
+
*/
|
|
7
|
+
export declare function canonicalJson(v: unknown): string;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical JSON (eval replay matching): object keys sorted recursively by code point, arrays in
|
|
3
|
+
* order, `undefined` left out by the JSON rules. A leaf module, so request building
|
|
4
|
+
* (`evals/reconstruct.ts`, reached from the runtime through the in-context summary) does not pull
|
|
5
|
+
* in the tool pipeline that `recorded-tools.ts` needs.
|
|
6
|
+
*/
|
|
7
|
+
export function canonicalJson(v) {
|
|
8
|
+
const norm = (x) => {
|
|
9
|
+
if (Array.isArray(x))
|
|
10
|
+
return x.map(norm);
|
|
11
|
+
if (x !== null && typeof x === "object") {
|
|
12
|
+
const o = x;
|
|
13
|
+
const out = {};
|
|
14
|
+
for (const k of Object.keys(o).sort())
|
|
15
|
+
out[k] = norm(o[k]);
|
|
16
|
+
return out;
|
|
17
|
+
}
|
|
18
|
+
return x;
|
|
19
|
+
};
|
|
20
|
+
return JSON.stringify(norm(v) ?? null);
|
|
21
|
+
}
|
|
@@ -5,13 +5,14 @@ import { sameModel, selectionAt } from "../conversations/selection.js";
|
|
|
5
5
|
import { ApiError } from "../errors.js";
|
|
6
6
|
import { COMPACTION_SETTINGS } from "../identity/settings.js";
|
|
7
7
|
import { latestSummary, mediaRefs, planMedia, } from "../runtime/context/build.js";
|
|
8
|
+
import { selectCacheTtl, trustedCache } from "../runtime/context/cache-ttl.js";
|
|
8
9
|
import { applyFit, estimateAfterFit, planFit, planningBounds, planSqueezedFit, sentOutputCap, } from "../runtime/context/fit.js";
|
|
9
10
|
import { assertRecordedPermissionEvents, permissionContextHistory, RecordedPermissionContextError, } from "../runtime/context/permission-profile.js";
|
|
10
11
|
import { estimateTokens } from "../runtime/context/tokens.js";
|
|
11
12
|
import { assembleModelRequest, } from "../runtime/model-call.js";
|
|
12
13
|
import { CHILD_REMOVED_TOOLS } from "../runtime/subagents/definition.js";
|
|
13
14
|
import { AGENT_TOOL } from "../tools/builtin-names.js";
|
|
14
|
-
import { canonicalJson } from "./
|
|
15
|
+
import { canonicalJson } from "./canonical-json.js";
|
|
15
16
|
import { toEvents } from "./snapshot.js";
|
|
16
17
|
/** `R` when the caller did not resolve the org's settings (the built-in platform default). */
|
|
17
18
|
const DEFAULT_RESERVE_TOKENS = COMPACTION_SETTINGS.parse({}).reserveTokens;
|
|
@@ -199,6 +200,16 @@ export function reconstructInputs(s, modelCallSeq, opts) {
|
|
|
199
200
|
}
|
|
200
201
|
const budget = opts.mediaBudgetBytes ?? rec.mediaBudgetBytes;
|
|
201
202
|
const readWindow = opts.readImagesPerRequest ?? rec.readImagesPerRequest;
|
|
203
|
+
// the prompt cache tier: a recorded transport option, not model-visible, so no DriftReason
|
|
204
|
+
// either way (idle compaction spec §9.2). The baseline sends the recorded value while the model
|
|
205
|
+
// still offers it (never a value the model does not offer); a candidate recomputes it for its
|
|
206
|
+
// model, with the long tier on when the recording asked for one.
|
|
207
|
+
const cacheTtl = baseline
|
|
208
|
+
? rec.cacheTtl !== undefined &&
|
|
209
|
+
trustedCache(opts.model.cache)?.ttlOptions.includes(rec.cacheTtl)
|
|
210
|
+
? rec.cacheTtl
|
|
211
|
+
: undefined
|
|
212
|
+
: selectCacheTtl(opts.model.cache, rec.cacheTtl !== undefined);
|
|
202
213
|
const input = {
|
|
203
214
|
events: inputEvents(all, call),
|
|
204
215
|
agent,
|
|
@@ -210,6 +221,7 @@ export function reconstructInputs(s, modelCallSeq, opts) {
|
|
|
210
221
|
tools,
|
|
211
222
|
toolSearch: rec.catalog !== undefined,
|
|
212
223
|
...(rec.toolChoice !== undefined && { toolChoice: rec.toolChoice }),
|
|
224
|
+
...(cacheTtl !== undefined && { cacheTtl }),
|
|
213
225
|
...(opts.mediaInfo !== undefined && { mediaInfo: opts.mediaInfo }),
|
|
214
226
|
...(opts.media !== undefined && { media: opts.media }),
|
|
215
227
|
...(budget !== undefined && { mediaBudgetBytes: budget }),
|
|
@@ -46,8 +46,6 @@ export interface RecordedCall {
|
|
|
46
46
|
*/
|
|
47
47
|
media?: ReadMedia[];
|
|
48
48
|
}
|
|
49
|
-
/** 规范化 JSON:对象键递归按码点排序,数组保持顺序;`undefined` 按 JSON 规则省略。 */
|
|
50
|
-
export declare function canonicalJson(v: unknown): string;
|
|
51
49
|
/** The matching key of a call: the canonical JSON of its input without the ignored fields. */
|
|
52
50
|
export declare function matchKey(toolKey: string, input: unknown): string;
|
|
53
51
|
/**
|
|
@@ -4,6 +4,7 @@ import { devicePathsChangeFromPayload, devicePathsLevel, } from "../runtime/cont
|
|
|
4
4
|
import { assistantIdemKey } from "../runtime/model-call.js";
|
|
5
5
|
import { MATCH_IGNORED_FIELDS } from "../tools/builtin-names.js";
|
|
6
6
|
import { RUN_STOPPED_TEXT } from "../tools/pipeline.js";
|
|
7
|
+
import { canonicalJson } from "./canonical-json.js";
|
|
7
8
|
/**
|
|
8
9
|
* 整轮回放的工具管线(C6 / Review Focus 3):只回放原运行记录的工具结果,**从不执行任何工具**——
|
|
9
10
|
* 不经过策略、审批、沙箱、连接器,也不调用任何处理函数。每个调用按 (toolKey, 规范化参数) 精确匹配第一条未用的记录;
|
|
@@ -11,22 +12,6 @@ import { RUN_STOPPED_TEXT } from "../tools/pipeline.js";
|
|
|
11
12
|
*/
|
|
12
13
|
/** 没有匹配记录时模型看到的工具结果(模型可见,英文)。 */
|
|
13
14
|
export const REPLAY_NO_RECORDING = "[replay] No recorded result matches this tool call (same tool and arguments); the tool was not executed during replay.";
|
|
14
|
-
/** 规范化 JSON:对象键递归按码点排序,数组保持顺序;`undefined` 按 JSON 规则省略。 */
|
|
15
|
-
export function canonicalJson(v) {
|
|
16
|
-
const norm = (x) => {
|
|
17
|
-
if (Array.isArray(x))
|
|
18
|
-
return x.map(norm);
|
|
19
|
-
if (x !== null && typeof x === "object") {
|
|
20
|
-
const o = x;
|
|
21
|
-
const out = {};
|
|
22
|
-
for (const k of Object.keys(o).sort())
|
|
23
|
-
out[k] = norm(o[k]);
|
|
24
|
-
return out;
|
|
25
|
-
}
|
|
26
|
-
return x;
|
|
27
|
-
};
|
|
28
|
-
return JSON.stringify(norm(v) ?? null);
|
|
29
|
-
}
|
|
30
15
|
/** The matching key of a call: the canonical JSON of its input without the ignored fields. */
|
|
31
16
|
export function matchKey(toolKey, input) {
|
|
32
17
|
const ignored = MATCH_IGNORED_FIELDS[toolKey];
|
package/dist/evals/snapshot.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { ConversationSource, ToolSpec } from "@capybara-hq/plugin-sdk";
|
|
|
2
2
|
import { type AgentDefinition } from "../agents/definition.js";
|
|
3
3
|
import type { ConversationEvent, ConversationEventType } from "../conversations/events.js";
|
|
4
4
|
import type { KernelSchemaDb } from "../db/kernel-schema.js";
|
|
5
|
+
import { type FollowUpNarrowing } from "../runtime/subagents/definition.js";
|
|
5
6
|
/**
|
|
6
7
|
* 评测用例快照(C3):复制截至某次运行终态的会话事件、这些事件引用的 agent 版本定义、请求用到的工具定义
|
|
7
8
|
* (按 specHash)。回放只读快照,不改原对话的日志;媒体不复制字节,回放时按引用取原附件。
|
|
@@ -59,11 +60,33 @@ export interface CaseSnapshot {
|
|
|
59
60
|
};
|
|
60
61
|
}
|
|
61
62
|
/**
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
63
|
+
* The follow-up narrowing of run `runId`: the one on the last sub-agent task message up to the
|
|
64
|
+
* run's last event (its terminal event when it has one), if any. A task message logged after the
|
|
65
|
+
* run (a later follow-up's, which a live snapshot may hold) never narrows this run's definition.
|
|
66
|
+
* Without any event of the run, every event counts.
|
|
67
|
+
*/
|
|
68
|
+
export declare function runTaskNarrowing(events: readonly SnapshotEvent[], runId: string): FollowUpNarrowing | undefined;
|
|
69
|
+
/**
|
|
70
|
+
* Takes a case snapshot of a run. The conversation not in the org, or the run not the
|
|
71
|
+
* conversation's → `conversation.not_found`; the run without a terminal event yet →
|
|
72
|
+
* `eval.run_not_finished` (409); over `maxBytes` bytes serialized → `eval.case_too_large` (413).
|
|
73
|
+
* The caller passes `maxBytes` (`evals.maxCaseBytes`).
|
|
65
74
|
*/
|
|
66
75
|
export declare function takeSnapshot(db: KernelSchemaDb, orgId: string, conversationId: string, runId: string, maxBytes: number): Promise<CaseSnapshot>;
|
|
76
|
+
/**
|
|
77
|
+
* A snapshot of events the caller already holds, for a request built live rather than stored (the
|
|
78
|
+
* in-context compaction summary, idle compaction spec §9.4): no terminal event is required and no
|
|
79
|
+
* byte cap applies, since nothing is stored. `runId` is the run of the call the request rebuilds;
|
|
80
|
+
* `conversation.not_found` as in {@link takeSnapshot}. `agentId` is the caller's check: a
|
|
81
|
+
* conversation whose agent differs is not found either.
|
|
82
|
+
*/
|
|
83
|
+
export declare function liveSnapshot(db: KernelSchemaDb, input: {
|
|
84
|
+
orgId: string;
|
|
85
|
+
conversationId: string;
|
|
86
|
+
runId: string;
|
|
87
|
+
agentId: string;
|
|
88
|
+
events: readonly ConversationEvent[];
|
|
89
|
+
}): Promise<CaseSnapshot>;
|
|
67
90
|
/**
|
|
68
91
|
* Reads a stored snapshot (`eval_cases.snapshot`): each version's definition goes through
|
|
69
92
|
* `normalizeStoredDefinition` (missing turned-off lists read as empty). Other fields as they are.
|
package/dist/evals/snapshot.js
CHANGED
|
@@ -1,20 +1,27 @@
|
|
|
1
1
|
import { normalizeStoredDefinition } from "../agents/definition.js";
|
|
2
2
|
import { ApiError } from "../errors.js";
|
|
3
3
|
import { childRunDefinition } from "../runtime/subagents/definition.js";
|
|
4
|
-
/**
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
/**
|
|
5
|
+
* The follow-up narrowing of run `runId`: the one on the last sub-agent task message up to the
|
|
6
|
+
* run's last event (its terminal event when it has one), if any. A task message logged after the
|
|
7
|
+
* run (a later follow-up's, which a live snapshot may hold) never narrows this run's definition.
|
|
8
|
+
* Without any event of the run, every event counts.
|
|
9
|
+
*/
|
|
10
|
+
export function runTaskNarrowing(events, runId) {
|
|
11
|
+
const end = events.findLast((e) => e.runId === runId)?.seq ?? Number.POSITIVE_INFINITY;
|
|
12
|
+
const task = events.findLast((e) => e.seq <= end &&
|
|
13
|
+
e.type === "user_message" &&
|
|
14
|
+
e.payload.dispatch !== undefined);
|
|
7
15
|
return task?.payload?.dispatch?.narrowed;
|
|
8
16
|
}
|
|
9
17
|
const TERMINAL = new Set(["run_finished", "run_failed", "run_aborted"]);
|
|
10
|
-
/**
|
|
18
|
+
/** The page size when reading events. */
|
|
11
19
|
const PAGE = 1000;
|
|
12
20
|
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* `maxBytes` 由调用方传入(`evals.maxCaseBytes`)。
|
|
21
|
+
* The conversation and the run's agent version; `conversation.not_found` when the conversation is
|
|
22
|
+
* not in the org or the run is not the conversation's.
|
|
16
23
|
*/
|
|
17
|
-
|
|
24
|
+
async function conversationRun(db, orgId, conversationId, runId) {
|
|
18
25
|
const conv = await db
|
|
19
26
|
.selectFrom("conversations")
|
|
20
27
|
.select(["agent_id", "kind", "source"])
|
|
@@ -32,51 +39,16 @@ export async function takeSnapshot(db, orgId, conversationId, runId, maxBytes) {
|
|
|
32
39
|
if (!conv || !run) {
|
|
33
40
|
throw new ApiError("conversation.not_found", "Conversation or run not found");
|
|
34
41
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
const endSeq = Number(end.seq);
|
|
46
|
-
const tooLarge = () => new ApiError("eval.case_too_large", `The run's snapshot is larger than the ${maxBytes}-byte limit`);
|
|
47
|
-
const events = [];
|
|
48
|
-
/** 已读事件序列化后的字节数(快照总大小的下界):一超过上限就停,不把超大的对话整个读进内存。 */
|
|
49
|
-
let bytes = 0;
|
|
50
|
-
let after = 0;
|
|
51
|
-
for (;;) {
|
|
52
|
-
const rows = await db
|
|
53
|
-
.selectFrom("conversation_events")
|
|
54
|
-
.select(["seq", "type", "run_id", "payload", "created_at"])
|
|
55
|
-
.where("conversation_id", "=", conversationId)
|
|
56
|
-
.where("seq", ">", String(after))
|
|
57
|
-
.where("seq", "<=", String(endSeq))
|
|
58
|
-
.orderBy("seq")
|
|
59
|
-
.limit(PAGE)
|
|
60
|
-
.execute();
|
|
61
|
-
for (const r of rows) {
|
|
62
|
-
const e = {
|
|
63
|
-
seq: Number(r.seq),
|
|
64
|
-
type: r.type,
|
|
65
|
-
payload: r.payload,
|
|
66
|
-
runId: r.run_id,
|
|
67
|
-
createdAt: new Date(r.created_at).toISOString(),
|
|
68
|
-
};
|
|
69
|
-
bytes += Buffer.byteLength(JSON.stringify(e));
|
|
70
|
-
if (bytes > maxBytes)
|
|
71
|
-
throw tooLarge();
|
|
72
|
-
events.push(e);
|
|
73
|
-
}
|
|
74
|
-
const last = rows.at(-1);
|
|
75
|
-
if (rows.length < PAGE || !last)
|
|
76
|
-
break;
|
|
77
|
-
after = Number(last.seq);
|
|
78
|
-
}
|
|
79
|
-
const versions = new Set([run.agent_version]);
|
|
42
|
+
return { conv, agentVersion: run.agent_version };
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* The snapshot of `events`: the agent versions they reference (each `run_started` and the run's
|
|
46
|
+
* own), the tool specs of every `model_call`'s `tools` / `catalog`, and a sub-agent's frozen
|
|
47
|
+
* definition and parent call. Shared by {@link takeSnapshot} and {@link liveSnapshot}.
|
|
48
|
+
*/
|
|
49
|
+
async function snapshotOf(db, ids, conv, agentVersion, events) {
|
|
50
|
+
const { orgId, conversationId, runId } = ids;
|
|
51
|
+
const versions = new Set([agentVersion]);
|
|
80
52
|
const hashes = new Set();
|
|
81
53
|
for (const e of events) {
|
|
82
54
|
if (e.type === "run_started") {
|
|
@@ -119,13 +91,13 @@ export async function takeSnapshot(db, orgId, conversationId, runId, maxBytes) {
|
|
|
119
91
|
.where("child_run_id", "=", runId)
|
|
120
92
|
.executeTakeFirst()
|
|
121
93
|
: undefined;
|
|
122
|
-
|
|
94
|
+
return {
|
|
123
95
|
version: 1,
|
|
124
96
|
orgId,
|
|
125
97
|
conversationId,
|
|
126
98
|
runId,
|
|
127
99
|
agentId: conv.agent_id,
|
|
128
|
-
agentVersion
|
|
100
|
+
agentVersion,
|
|
129
101
|
source: conv.source,
|
|
130
102
|
events,
|
|
131
103
|
definitions,
|
|
@@ -133,8 +105,8 @@ export async function takeSnapshot(db, orgId, conversationId, runId, maxBytes) {
|
|
|
133
105
|
...(started !== undefined && {
|
|
134
106
|
subagent: {
|
|
135
107
|
// this run's definition: the frozen one with its follow-up's narrowing (final review
|
|
136
|
-
// I1); the run's task message is the last one up to
|
|
137
|
-
definition: childRunDefinition(normalizeStoredDefinition(started.definition),
|
|
108
|
+
// I1); the run's task message is the last one up to the run's last event
|
|
109
|
+
definition: childRunDefinition(normalizeStoredDefinition(started.definition), runTaskNarrowing(events, runId)),
|
|
138
110
|
preamble: started.preamble,
|
|
139
111
|
...(invokedSkill !== undefined && { invokedSkill }),
|
|
140
112
|
},
|
|
@@ -147,10 +119,91 @@ export async function takeSnapshot(db, orgId, conversationId, runId, maxBytes) {
|
|
|
147
119
|
},
|
|
148
120
|
}),
|
|
149
121
|
};
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Takes a case snapshot of a run. The conversation not in the org, or the run not the
|
|
125
|
+
* conversation's → `conversation.not_found`; the run without a terminal event yet →
|
|
126
|
+
* `eval.run_not_finished` (409); over `maxBytes` bytes serialized → `eval.case_too_large` (413).
|
|
127
|
+
* The caller passes `maxBytes` (`evals.maxCaseBytes`).
|
|
128
|
+
*/
|
|
129
|
+
export async function takeSnapshot(db, orgId, conversationId, runId, maxBytes) {
|
|
130
|
+
const { conv, agentVersion } = await conversationRun(db, orgId, conversationId, runId);
|
|
131
|
+
const end = await db
|
|
132
|
+
.selectFrom("conversation_events")
|
|
133
|
+
.select("seq")
|
|
134
|
+
.where("conversation_id", "=", conversationId)
|
|
135
|
+
.where("run_id", "=", runId)
|
|
136
|
+
.where("type", "in", [...TERMINAL])
|
|
137
|
+
.orderBy("seq")
|
|
138
|
+
.executeTakeFirst();
|
|
139
|
+
if (!end)
|
|
140
|
+
throw new ApiError("eval.run_not_finished", "The run has not finished yet");
|
|
141
|
+
const endSeq = Number(end.seq);
|
|
142
|
+
const tooLarge = () => new ApiError("eval.case_too_large", `The run's snapshot is larger than the ${maxBytes}-byte limit`);
|
|
143
|
+
const events = [];
|
|
144
|
+
/**
|
|
145
|
+
* Serialized bytes of the events read so far (a lower bound of the snapshot's size): stop as
|
|
146
|
+
* soon as it is over the limit, never reading a huge conversation into memory whole.
|
|
147
|
+
*/
|
|
148
|
+
let bytes = 0;
|
|
149
|
+
let after = 0;
|
|
150
|
+
for (;;) {
|
|
151
|
+
const rows = await db
|
|
152
|
+
.selectFrom("conversation_events")
|
|
153
|
+
.select(["seq", "type", "run_id", "payload", "created_at"])
|
|
154
|
+
.where("conversation_id", "=", conversationId)
|
|
155
|
+
.where("seq", ">", String(after))
|
|
156
|
+
.where("seq", "<=", String(endSeq))
|
|
157
|
+
.orderBy("seq")
|
|
158
|
+
.limit(PAGE)
|
|
159
|
+
.execute();
|
|
160
|
+
for (const r of rows) {
|
|
161
|
+
const e = {
|
|
162
|
+
seq: Number(r.seq),
|
|
163
|
+
type: r.type,
|
|
164
|
+
payload: r.payload,
|
|
165
|
+
runId: r.run_id,
|
|
166
|
+
createdAt: new Date(r.created_at).toISOString(),
|
|
167
|
+
};
|
|
168
|
+
bytes += Buffer.byteLength(JSON.stringify(e));
|
|
169
|
+
if (bytes > maxBytes)
|
|
170
|
+
throw tooLarge();
|
|
171
|
+
events.push(e);
|
|
172
|
+
}
|
|
173
|
+
const last = rows.at(-1);
|
|
174
|
+
if (rows.length < PAGE || !last)
|
|
175
|
+
break;
|
|
176
|
+
after = Number(last.seq);
|
|
177
|
+
}
|
|
178
|
+
const snapshot = await snapshotOf(db, { orgId, conversationId, runId }, conv, agentVersion, events);
|
|
150
179
|
if (Buffer.byteLength(JSON.stringify(snapshot)) > maxBytes)
|
|
151
180
|
throw tooLarge();
|
|
152
181
|
return snapshot;
|
|
153
182
|
}
|
|
183
|
+
/**
|
|
184
|
+
* A snapshot of events the caller already holds, for a request built live rather than stored (the
|
|
185
|
+
* in-context compaction summary, idle compaction spec §9.4): no terminal event is required and no
|
|
186
|
+
* byte cap applies, since nothing is stored. `runId` is the run of the call the request rebuilds;
|
|
187
|
+
* `conversation.not_found` as in {@link takeSnapshot}. `agentId` is the caller's check: a
|
|
188
|
+
* conversation whose agent differs is not found either.
|
|
189
|
+
*/
|
|
190
|
+
export async function liveSnapshot(db, input) {
|
|
191
|
+
const { orgId, conversationId, runId } = input;
|
|
192
|
+
const { conv, agentVersion } = await conversationRun(db, orgId, conversationId, runId);
|
|
193
|
+
if (conv.agent_id !== input.agentId) {
|
|
194
|
+
throw new ApiError("conversation.not_found", "Conversation or run not found");
|
|
195
|
+
}
|
|
196
|
+
const events = [...input.events]
|
|
197
|
+
.sort((a, b) => a.seq - b.seq)
|
|
198
|
+
.map((e) => ({
|
|
199
|
+
seq: e.seq,
|
|
200
|
+
type: e.type,
|
|
201
|
+
payload: e.payload,
|
|
202
|
+
runId: e.runId,
|
|
203
|
+
createdAt: new Date(e.createdAt).toISOString(),
|
|
204
|
+
}));
|
|
205
|
+
return snapshotOf(db, { orgId, conversationId, runId }, conv, agentVersion, events);
|
|
206
|
+
}
|
|
154
207
|
/**
|
|
155
208
|
* Reads a stored snapshot (`eval_cases.snapshot`): each version's definition goes through
|
|
156
209
|
* `normalizeStoredDefinition` (missing turned-off lists read as empty). Other fields as they are.
|
package/dist/evals/worker.d.ts
CHANGED
|
@@ -45,9 +45,10 @@ export declare const EVAL_REPLAY_HOOKS: unique symbol;
|
|
|
45
45
|
/**
|
|
46
46
|
* The loop deps of a full-run replay: the run's own step deps without anything live that a replay
|
|
47
47
|
* must never trigger, then the replay's overrides. Removed: plugin hooks (P-18), sub-agent and
|
|
48
|
-
* compaction progress on a live stream, fork dispatch (run-replay passes the recorded reports)
|
|
49
|
-
* the live permission context recorder (permission context
|
|
50
|
-
* recorded feeder `overrides.permissionContext`, and none
|
|
48
|
+
* compaction progress on a live stream, fork dispatch (run-replay passes the recorded reports), the
|
|
49
|
+
* in-context summary's live snapshot and the live permission context recorder (permission context
|
|
50
|
+
* replay spec B4): a replay gets only the recorded feeder `overrides.permissionContext`, and none
|
|
51
|
+
* at all for a recording without markers.
|
|
51
52
|
*/
|
|
52
53
|
export declare function replayLoopDeps(stepDeps: LoopDeps, overrides: Parameters<RunReplayDeps["loop"]>[0]): LoopDeps;
|
|
53
54
|
export declare class EvalWorker {
|
package/dist/evals/worker.js
CHANGED
|
@@ -73,14 +73,18 @@ const isPluginUnloaded = (err) => err instanceof ExtensionUnloadedError ||
|
|
|
73
73
|
/**
|
|
74
74
|
* The loop deps of a full-run replay: the run's own step deps without anything live that a replay
|
|
75
75
|
* must never trigger, then the replay's overrides. Removed: plugin hooks (P-18), sub-agent and
|
|
76
|
-
* compaction progress on a live stream, fork dispatch (run-replay passes the recorded reports)
|
|
77
|
-
* the live permission context recorder (permission context
|
|
78
|
-
* recorded feeder `overrides.permissionContext`, and none
|
|
76
|
+
* compaction progress on a live stream, fork dispatch (run-replay passes the recorded reports), the
|
|
77
|
+
* in-context summary's live snapshot and the live permission context recorder (permission context
|
|
78
|
+
* replay spec B4): a replay gets only the recorded feeder `overrides.permissionContext`, and none
|
|
79
|
+
* at all for a recording without markers.
|
|
79
80
|
*/
|
|
80
81
|
export function replayLoopDeps(stepDeps, overrides) {
|
|
81
82
|
const { db: _snapshot, hooks: _noHooks, subagentProgress: _noProgress, compactionProgress: _noCompactionProgress, skillForks: _noForks, permissionContext: _noLivePermissionContext,
|
|
82
83
|
// a replay never reads a device for a streaming Write's base
|
|
83
|
-
writeBase: _noWriteBase,
|
|
84
|
+
writeBase: _noWriteBase,
|
|
85
|
+
// a replayed compaction summarizes the transcript (idle compaction spec §9.4): the replay
|
|
86
|
+
// conversation has no live snapshot of its own
|
|
87
|
+
liveSnapshot: _noLiveSnapshot, ...replayDeps } = stepDeps;
|
|
84
88
|
// the object rest above copied `db` as a value: read it through the step deps' getter
|
|
85
89
|
// instead, so the loop always resolves the context-aware handle
|
|
86
90
|
return {
|
|
@@ -20,7 +20,7 @@ import { OrgNetworkAllowances } from "../orgs/network-allowances.service.js";
|
|
|
20
20
|
import { DeviceReports } from "../sandbox/device-reports.js";
|
|
21
21
|
import { ShareLiveness } from "../shares/liveness.js";
|
|
22
22
|
import { EmbedTokens } from "../ui/embed-token.js";
|
|
23
|
-
import type { UiActionHandler, UiRender } from "../ui/registry.js";
|
|
23
|
+
import type { UiActionHandler, UiQueryHandler, UiRender } from "../ui/registry.js";
|
|
24
24
|
import { ExtensionApprovals, type PendingExtension } from "./approvals.js";
|
|
25
25
|
import { deploymentConfigHash } from "./config-hash.js";
|
|
26
26
|
import { EffectiveConfigs } from "./effective-config.js";
|
|
@@ -46,6 +46,8 @@ export interface LoadedUiContribution {
|
|
|
46
46
|
after?: string;
|
|
47
47
|
render?: UiRender;
|
|
48
48
|
action?: UiActionHandler;
|
|
49
|
+
/** A component's `ctx.ui.query` handler. */
|
|
50
|
+
query?: UiQueryHandler;
|
|
49
51
|
}
|
|
50
52
|
export type { ExtensionPointEntry } from "./registry.js";
|
|
51
53
|
/** One item of {@link ExtensionHost.inspect}. */
|
package/dist/extensions/host.js
CHANGED
|
@@ -2162,6 +2162,7 @@ let ExtensionHost = class ExtensionHost {
|
|
|
2162
2162
|
const served = c.kind === "view" || c.kind === "component";
|
|
2163
2163
|
const render = served ? i.uiViews.get(c.id) : undefined;
|
|
2164
2164
|
const action = served ? i.uiActions.get(c.id) : undefined;
|
|
2165
|
+
const query = c.kind === "component" ? i.uiQueries.get(c.id) : undefined;
|
|
2165
2166
|
return {
|
|
2166
2167
|
plugin: i.name,
|
|
2167
2168
|
contribution: c,
|
|
@@ -2169,6 +2170,7 @@ let ExtensionHost = class ExtensionHost {
|
|
|
2169
2170
|
...(after !== undefined && { after }),
|
|
2170
2171
|
...(render !== undefined && { render }),
|
|
2171
2172
|
...(action !== undefined && { action }),
|
|
2173
|
+
...(query !== undefined && { query }),
|
|
2172
2174
|
};
|
|
2173
2175
|
}));
|
|
2174
2176
|
}
|