@sixb/core 0.1.6 → 0.1.8
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/actions/delegated-admission.d.ts +24 -0
- package/dist/actions/delegated-admission.d.ts.map +1 -0
- package/dist/actions/descriptor.d.ts +29 -0
- package/dist/actions/descriptor.d.ts.map +1 -0
- package/dist/actions/execution.d.ts +5 -5
- package/dist/actions/execution.d.ts.map +1 -1
- package/dist/actions/index.js +50 -40
- package/dist/actions/index.js.map +1 -1
- package/dist/actions/request.d.ts.map +1 -1
- package/dist/actions/run-authorization.d.ts +20 -0
- package/dist/actions/run-authorization.d.ts.map +1 -0
- package/dist/actions/run-dispatch.d.ts +3 -1
- package/dist/actions/run-dispatch.d.ts.map +1 -1
- package/dist/actions/worker.js +5 -5
- package/dist/actions/worker.js.map +1 -1
- package/dist/agents/adapters.d.ts +6 -166
- package/dist/agents/adapters.d.ts.map +1 -1
- package/dist/agents/authority.d.ts +22 -6
- package/dist/agents/authority.d.ts.map +1 -1
- package/dist/agents/builders.d.ts +3 -11
- package/dist/agents/builders.d.ts.map +1 -1
- package/dist/agents/context-resolution.d.ts.map +1 -1
- package/dist/agents/context.js +2 -2
- package/dist/agents/dispatch.d.ts +9 -1
- package/dist/agents/dispatch.d.ts.map +1 -1
- package/dist/agents/errors.d.ts +1 -10
- package/dist/agents/errors.d.ts.map +1 -1
- package/dist/agents/execution.d.ts +9 -10
- package/dist/agents/execution.d.ts.map +1 -1
- package/dist/agents/identity.d.ts +3 -0
- package/dist/agents/identity.d.ts.map +1 -0
- package/dist/agents/ids.d.ts +4 -0
- package/dist/agents/ids.d.ts.map +1 -1
- package/dist/agents/index.d.ts +15 -11
- package/dist/agents/index.d.ts.map +1 -1
- package/dist/agents/index.js +90 -78
- package/dist/agents/index.js.map +1 -1
- package/dist/agents/message.d.ts +19 -13
- package/dist/agents/message.d.ts.map +1 -1
- package/dist/agents/model-loop.d.ts +58 -0
- package/dist/agents/model-loop.d.ts.map +1 -0
- package/dist/agents/reference.d.ts +4 -0
- package/dist/agents/reference.d.ts.map +1 -0
- package/dist/agents/request.d.ts +10 -8
- package/dist/agents/request.d.ts.map +1 -1
- package/dist/agents/retired-config.d.ts +4 -0
- package/dist/agents/retired-config.d.ts.map +1 -0
- package/dist/agents/streams.d.ts +13 -8
- package/dist/agents/streams.d.ts.map +1 -1
- package/dist/agents/streams.js +7 -5
- package/dist/agents/streams.js.map +1 -1
- package/dist/agents/tool-catalog.d.ts +9 -0
- package/dist/agents/tool-catalog.d.ts.map +1 -0
- package/dist/agents/tool-definition.d.ts +1 -1
- package/dist/agents/tool-definition.d.ts.map +1 -1
- package/dist/agents/types.d.ts +31 -68
- package/dist/agents/types.d.ts.map +1 -1
- package/dist/agents/validation.d.ts +3 -13
- package/dist/agents/validation.d.ts.map +1 -1
- package/dist/ai-usage/execution.d.ts +53 -0
- package/dist/ai-usage/execution.d.ts.map +1 -0
- package/dist/ai-usage/index.d.ts +3 -0
- package/dist/ai-usage/index.d.ts.map +1 -0
- package/dist/auth/index.js +12 -9
- package/dist/auth/index.js.map +1 -1
- package/dist/authorization/decision.d.ts +14 -3
- package/dist/authorization/decision.d.ts.map +1 -1
- package/dist/authorization/grant-kinds.d.ts +25 -8
- package/dist/authorization/grant-kinds.d.ts.map +1 -1
- package/dist/authorization/index.d.ts +1 -1
- package/dist/authorization/index.d.ts.map +1 -1
- package/dist/authorization/index.js +12 -7
- package/dist/authorization/index.js.map +1 -1
- package/dist/authorization/resolve.d.ts +3 -3
- package/dist/authorization/resolve.d.ts.map +1 -1
- package/dist/authorization/types.d.ts +7 -5
- package/dist/authorization/types.d.ts.map +1 -1
- package/dist/blob-storage/browser.js +2 -2
- package/dist/blob-storage/index.js +3 -3
- package/dist/bootstrap/discovery.d.ts +6 -6
- package/dist/bootstrap/discovery.d.ts.map +1 -1
- package/dist/bootstrap/index.js +62 -51
- package/dist/bootstrap/index.js.map +1 -1
- package/dist/bootstrap/ontology-type-manifest.d.ts.map +1 -1
- package/dist/broker/index.js +2 -2
- package/dist/{chunk-zqysyfjt.js → chunk-08m3b6w8.js} +1 -1
- package/dist/chunk-19jp6g9d.js +131 -0
- package/dist/chunk-19jp6g9d.js.map +11 -0
- package/dist/{chunk-3j7573mj.js → chunk-2dw777qw.js} +50 -5
- package/dist/{chunk-3j7573mj.js.map → chunk-2dw777qw.js.map} +4 -3
- package/dist/{chunk-0172wgm9.js → chunk-2xns679x.js} +10 -2
- package/dist/{chunk-0172wgm9.js.map → chunk-2xns679x.js.map} +3 -3
- package/dist/chunk-359jm1jw.js +147 -0
- package/dist/chunk-359jm1jw.js.map +10 -0
- package/dist/{chunk-dy311asx.js → chunk-3xep5cjx.js} +58 -23
- package/dist/chunk-3xep5cjx.js.map +15 -0
- package/dist/{chunk-n4spznws.js → chunk-3z1qec12.js} +83 -12
- package/dist/chunk-3z1qec12.js.map +12 -0
- package/dist/{chunk-z3zp0bj1.js → chunk-407j3msh.js} +1 -1
- package/dist/{chunk-rhrbz7d4.js → chunk-4a849fr1.js} +1 -1
- package/dist/{chunk-cy0n5dms.js → chunk-4jjp5k14.js} +1 -1
- package/dist/chunk-4qfkag59.js +1568 -0
- package/dist/chunk-4qfkag59.js.map +20 -0
- package/dist/{chunk-1e8m6yn3.js → chunk-4sm0aznx.js} +685 -86
- package/dist/chunk-4sm0aznx.js.map +43 -0
- package/dist/chunk-4yqmp43v.js +159 -0
- package/dist/chunk-4yqmp43v.js.map +11 -0
- package/dist/{chunk-rdeagz6b.js → chunk-5e3pq99w.js} +3 -7
- package/dist/{chunk-rdeagz6b.js.map → chunk-5e3pq99w.js.map} +3 -3
- package/dist/{chunk-ezake7g1.js → chunk-5ntny1qx.js} +1 -1
- package/dist/{chunk-dm72y8wt.js → chunk-7y0f6rf1.js} +29 -16
- package/dist/chunk-7y0f6rf1.js.map +10 -0
- package/dist/{chunk-72q2y8hn.js → chunk-8tsf6dmc.js} +2 -2
- package/dist/{chunk-qewtks41.js → chunk-9nbmsvn5.js} +123 -20
- package/dist/chunk-9nbmsvn5.js.map +11 -0
- package/dist/{chunk-5sxb1168.js → chunk-aa2pen2v.js} +256 -82
- package/dist/chunk-aa2pen2v.js.map +34 -0
- package/dist/{chunk-819wnjz8.js → chunk-ajnan18g.js} +13 -10
- package/dist/chunk-ajnan18g.js.map +12 -0
- package/dist/chunk-c15dr03f.js +43 -0
- package/dist/chunk-c15dr03f.js.map +10 -0
- package/dist/{chunk-t0jjkep3.js → chunk-d8qkxt2v.js} +4 -2
- package/dist/chunk-d8qkxt2v.js.map +10 -0
- package/dist/{chunk-vybf6pkp.js → chunk-dbc80ad7.js} +1 -1
- package/dist/{chunk-nkbfrt0c.js → chunk-f26bck4t.js} +7 -7
- package/dist/{chunk-x2yw73hy.js → chunk-fvt9rjsa.js} +23 -7
- package/dist/chunk-fvt9rjsa.js.map +10 -0
- package/dist/{chunk-znagycq7.js → chunk-gbejpkex.js} +5 -5
- package/dist/{chunk-znagycq7.js.map → chunk-gbejpkex.js.map} +1 -1
- package/dist/{chunk-e42bc6m3.js → chunk-gzasd5b6.js} +5 -5
- package/dist/{chunk-e42bc6m3.js.map → chunk-gzasd5b6.js.map} +3 -3
- package/dist/{chunk-rnshztfq.js → chunk-h0k55pc7.js} +6 -6
- package/dist/{chunk-rnshztfq.js.map → chunk-h0k55pc7.js.map} +1 -1
- package/dist/chunk-h5vqbfmd.js +1537 -0
- package/dist/chunk-h5vqbfmd.js.map +19 -0
- package/dist/chunk-j1sbhm7p.js +45 -0
- package/dist/chunk-j1sbhm7p.js.map +10 -0
- package/dist/chunk-jecn6t54.js +307 -0
- package/dist/chunk-jecn6t54.js.map +12 -0
- package/dist/{chunk-dsrkgtnh.js → chunk-jq43kdvk.js} +1 -1
- package/dist/{chunk-wtmzkcht.js → chunk-k34z5rvh.js} +1 -1
- package/dist/{chunk-f6erf2vv.js → chunk-k522z7v6.js} +10 -5
- package/dist/chunk-k522z7v6.js.map +10 -0
- package/dist/{chunk-htq0qh7z.js → chunk-ka3a2ft3.js} +2 -2
- package/dist/{chunk-ckxfnx7f.js → chunk-mth82m8t.js} +129 -95
- package/dist/chunk-mth82m8t.js.map +14 -0
- package/dist/{chunk-5gynx4xn.js → chunk-mwsxn98e.js} +79 -77
- package/dist/{chunk-5gynx4xn.js.map → chunk-mwsxn98e.js.map} +8 -8
- package/dist/{chunk-f2rt4vkh.js → chunk-n2w475r0.js} +3 -3
- package/dist/chunk-n4khvw9n.js +111 -0
- package/dist/chunk-n4khvw9n.js.map +11 -0
- package/dist/{chunk-t8t39h7v.js → chunk-n6jxh8sw.js} +10 -2
- package/dist/chunk-n6jxh8sw.js.map +10 -0
- package/dist/chunk-nn0tekr1.js +284 -0
- package/dist/chunk-nn0tekr1.js.map +12 -0
- package/dist/chunk-nx7k8tpr.js +436 -0
- package/dist/chunk-nx7k8tpr.js.map +12 -0
- package/dist/{chunk-drjqm1aa.js → chunk-p03r0h5s.js} +310 -28
- package/dist/chunk-p03r0h5s.js.map +16 -0
- package/dist/{chunk-1g8negke.js → chunk-p1rzczbt.js} +93 -8
- package/dist/chunk-p1rzczbt.js.map +12 -0
- package/dist/{chunk-f83ka50g.js → chunk-p1x242ad.js} +652 -77
- package/dist/chunk-p1x242ad.js.map +25 -0
- package/dist/chunk-p2vqaxkc.js +528 -0
- package/dist/chunk-p2vqaxkc.js.map +15 -0
- package/dist/{chunk-a31h57d5.js → chunk-pc7ys28c.js} +70 -7
- package/dist/chunk-pc7ys28c.js.map +14 -0
- package/dist/{chunk-md8k0r54.js → chunk-q0k9nc5a.js} +281 -89
- package/dist/chunk-q0k9nc5a.js.map +14 -0
- package/dist/{chunk-bhxaq2nn.js → chunk-qw9gvjv5.js} +1 -1
- package/dist/chunk-r8jrnexe.js +403 -0
- package/dist/chunk-r8jrnexe.js.map +10 -0
- package/dist/{chunk-h9kxd41f.js → chunk-rafagrwr.js} +48 -7
- package/dist/chunk-rafagrwr.js.map +11 -0
- package/dist/{chunk-dysw7nsm.js → chunk-rv2hkwwa.js} +2 -2
- package/dist/{chunk-ghteq96b.js → chunk-s5y30bc9.js} +2 -2
- package/dist/{chunk-t624af60.js → chunk-sbzzr4kx.js} +1848 -757
- package/dist/chunk-sbzzr4kx.js.map +63 -0
- package/dist/{chunk-6gjqgd3d.js → chunk-tpnd31c1.js} +2 -1
- package/dist/chunk-tpnd31c1.js.map +11 -0
- package/dist/chunk-trxxmgnf.js +68 -0
- package/dist/chunk-trxxmgnf.js.map +11 -0
- package/dist/{chunk-0hc5j867.js → chunk-v1xppd0y.js} +17 -13
- package/dist/{chunk-0hc5j867.js.map → chunk-v1xppd0y.js.map} +2 -2
- package/dist/chunk-v4en4jc2.js +252 -0
- package/dist/chunk-v4en4jc2.js.map +10 -0
- package/dist/{chunk-xkthy56g.js → chunk-w1tvjszy.js} +1 -1
- package/dist/{chunk-8b55ygje.js → chunk-w3e09qqk.js} +1 -1
- package/dist/{chunk-8gv5z0zm.js → chunk-w9tg6yyb.js} +13 -8
- package/dist/{chunk-8gv5z0zm.js.map → chunk-w9tg6yyb.js.map} +3 -3
- package/dist/{chunk-62c7t4jc.js → chunk-wdage1eb.js} +1 -1
- package/dist/{chunk-tg5mee00.js → chunk-wtf06et8.js} +11 -7
- package/dist/{chunk-tg5mee00.js.map → chunk-wtf06et8.js.map} +3 -3
- package/dist/{chunk-nva1xkjz.js → chunk-xajtptbw.js} +1237 -1434
- package/dist/chunk-xajtptbw.js.map +40 -0
- package/dist/{chunk-xc7hq65b.js → chunk-yp8ee62z.js} +49 -2
- package/dist/chunk-yp8ee62z.js.map +11 -0
- package/dist/chunk-z4ccwbkz.js +139 -0
- package/dist/chunk-z4ccwbkz.js.map +10 -0
- package/dist/datasets/builders.d.ts +11 -2
- package/dist/datasets/builders.d.ts.map +1 -1
- package/dist/datasets/changes.d.ts +14 -4
- package/dist/datasets/changes.d.ts.map +1 -1
- package/dist/datasets/execution.d.ts +15 -1
- package/dist/datasets/execution.d.ts.map +1 -1
- package/dist/datasets/index.d.ts +1 -0
- package/dist/datasets/index.d.ts.map +1 -1
- package/dist/datasets/sequence.d.ts +7 -0
- package/dist/datasets/sequence.d.ts.map +1 -0
- package/dist/datasets/types.d.ts +1 -0
- package/dist/datasets/types.d.ts.map +1 -1
- package/dist/datasets/validation.d.ts.map +1 -1
- package/dist/datasets/write.d.ts +37 -0
- package/dist/datasets/write.d.ts.map +1 -0
- package/dist/datasets/write.js +17 -0
- package/dist/datasets/write.js.map +9 -0
- package/dist/error-reporting/internal.js +4 -4
- package/dist/error-reporting/types.d.ts +7 -2
- package/dist/error-reporting/types.d.ts.map +1 -1
- package/dist/errors/catalog.d.ts +8 -0
- package/dist/errors/catalog.d.ts.map +1 -1
- package/dist/errors/internal.js +2 -2
- package/dist/events/execution.d.ts.map +1 -1
- package/dist/events/index.js +4 -4
- package/dist/events/types/datasets.d.ts +2 -6
- package/dist/events/types/datasets.d.ts.map +1 -1
- package/dist/execution/agent.d.ts +18 -9
- package/dist/execution/agent.d.ts.map +1 -1
- package/dist/execution/agent.js +62 -46
- package/dist/execution/agent.js.map +1 -1
- package/dist/execution/authorization.d.ts +68 -20
- package/dist/execution/authorization.d.ts.map +1 -1
- package/dist/execution/authorized-object-reader.d.ts +69 -0
- package/dist/execution/authorized-object-reader.d.ts.map +1 -0
- package/dist/execution/durable.d.ts.map +1 -1
- package/dist/execution/index.d.ts +1 -1
- package/dist/execution/index.d.ts.map +1 -1
- package/dist/execution/primitive.js +55 -46
- package/dist/execution/primitive.js.map +2 -2
- package/dist/execution/request.d.ts +14 -1
- package/dist/execution/request.d.ts.map +1 -1
- package/dist/execution/request.js +92 -54
- package/dist/execution/request.js.map +3 -3
- package/dist/execution/scopes.d.ts +16 -0
- package/dist/execution/scopes.d.ts.map +1 -1
- package/dist/execution/types.d.ts +10 -1
- package/dist/execution/types.d.ts.map +1 -1
- package/dist/http/api-routes.d.ts +2 -0
- package/dist/http/api-routes.d.ts.map +1 -1
- package/dist/http/index.js +1 -1
- package/dist/index.d.ts +15 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +128 -109
- package/dist/index.js.map +1 -1
- package/dist/json.d.ts +2 -0
- package/dist/json.d.ts.map +1 -1
- package/dist/lake-storage/definition-updates.d.ts.map +1 -1
- package/dist/lake-storage/errors.d.ts +5 -1
- package/dist/lake-storage/errors.d.ts.map +1 -1
- package/dist/lake-storage/in-memory.d.ts +1 -0
- package/dist/lake-storage/in-memory.d.ts.map +1 -1
- package/dist/lake-storage/index.d.ts +6 -1
- package/dist/lake-storage/index.d.ts.map +1 -1
- package/dist/lake-storage/index.js +27 -10
- package/dist/lake-storage/index.js.map +1 -1
- package/dist/lake-storage/merge-validation.d.ts.map +1 -1
- package/dist/lake-storage/merge.d.ts +13 -2
- package/dist/lake-storage/merge.d.ts.map +1 -1
- package/dist/lake-storage/source-ordering.d.ts +19 -0
- package/dist/lake-storage/source-ordering.d.ts.map +1 -0
- package/dist/lake-storage/sql-transforms.d.ts +2 -1
- package/dist/lake-storage/sql-transforms.d.ts.map +1 -1
- package/dist/lake-storage/types.d.ts +10 -5
- package/dist/lake-storage/types.d.ts.map +1 -1
- package/dist/lake-storage/version-inputs.d.ts +4 -0
- package/dist/lake-storage/version-inputs.d.ts.map +1 -0
- package/dist/logging/index.js +3 -3
- package/dist/logging/types.js +2 -2
- package/dist/materialization/index.js +2 -2
- package/dist/materializer/index.js +38 -31
- package/dist/materializer/index.js.map +1 -1
- package/dist/models/catalog.d.ts +40 -0
- package/dist/models/catalog.d.ts.map +1 -0
- package/dist/models/definitions.d.ts +25 -0
- package/dist/models/definitions.d.ts.map +1 -0
- package/dist/models/errors.d.ts +52 -0
- package/dist/models/errors.d.ts.map +1 -0
- package/dist/models/events.d.ts +192 -0
- package/dist/models/events.d.ts.map +1 -0
- package/dist/models/index.d.ts +17 -39
- package/dist/models/index.d.ts.map +1 -1
- package/dist/models/index.js +50 -0
- package/dist/models/index.js.map +9 -0
- package/dist/models/language-model.d.ts +90 -0
- package/dist/models/language-model.d.ts.map +1 -0
- package/dist/models/messages.d.ts +74 -0
- package/dist/models/messages.d.ts.map +1 -0
- package/dist/models/pricing.d.ts +69 -0
- package/dist/models/pricing.d.ts.map +1 -0
- package/dist/models/rate-card.d.ts +24 -0
- package/dist/models/rate-card.d.ts.map +1 -0
- package/dist/models/tools.d.ts +24 -0
- package/dist/models/tools.d.ts.map +1 -0
- package/dist/objects/authorized-ontology-view.d.ts +25 -0
- package/dist/objects/authorized-ontology-view.d.ts.map +1 -0
- package/dist/objects/execution.d.ts +1 -1
- package/dist/objects/execution.d.ts.map +1 -1
- package/dist/objects/index.js +43 -36
- package/dist/objects/index.js.map +1 -1
- package/dist/objects/link/authorization.d.ts +2 -7
- package/dist/objects/link/authorization.d.ts.map +1 -1
- package/dist/objects/query/executor.d.ts +4 -2
- package/dist/objects/query/executor.d.ts.map +1 -1
- package/dist/objects/query/index.js +36 -29
- package/dist/objects/query/index.js.map +1 -1
- package/dist/objects/query/links.d.ts +22 -1
- package/dist/objects/query/links.d.ts.map +1 -1
- package/dist/objects/query/selected-read-admission.d.ts +27 -0
- package/dist/objects/query/selected-read-admission.d.ts.map +1 -0
- package/dist/objects/query/validate.d.ts +60 -2
- package/dist/objects/query/validate.d.ts.map +1 -1
- package/dist/objects/sdk/object-handle.d.ts.map +1 -1
- package/dist/objects/sdk/object-set.d.ts.map +1 -1
- package/dist/objects/sdk/runtime-query-executor.d.ts +2 -7
- package/dist/objects/sdk/runtime-query-executor.d.ts.map +1 -1
- package/dist/objects/sdk/telemetry-channel.d.ts.map +1 -1
- package/dist/objects/service/list-service.d.ts +2 -3
- package/dist/objects/service/list-service.d.ts.map +1 -1
- package/dist/objects/telemetry/history.d.ts +8 -6
- package/dist/objects/telemetry/history.d.ts.map +1 -1
- package/dist/objects/telemetry/index.d.ts +2 -2
- package/dist/objects/telemetry/index.d.ts.map +1 -1
- package/dist/objects/telemetry/workload.d.ts +11 -0
- package/dist/objects/telemetry/workload.d.ts.map +1 -0
- package/dist/ontology/index.d.ts +2 -1
- package/dist/ontology/index.d.ts.map +1 -1
- package/dist/ontology/index.js +15 -14
- package/dist/ontology/index.js.map +1 -1
- package/dist/ontology/inference/index.d.ts +2 -1
- package/dist/ontology/inference/index.d.ts.map +1 -1
- package/dist/ontology/internal.d.ts +0 -1
- package/dist/ontology/internal.d.ts.map +1 -1
- package/dist/ontology/internal.js +5 -10
- package/dist/ontology/internal.js.map +3 -3
- package/dist/ontology/json-schema.d.ts +10 -6
- package/dist/ontology/json-schema.d.ts.map +1 -1
- package/dist/ontology/link-path-selection.d.ts +35 -0
- package/dist/ontology/link-path-selection.d.ts.map +1 -0
- package/dist/ontology/refs.d.ts +2 -0
- package/dist/ontology/refs.d.ts.map +1 -1
- package/dist/ontology/tokens.d.ts +2 -1
- package/dist/ontology/tokens.d.ts.map +1 -1
- package/dist/pipelines/execution.d.ts.map +1 -1
- package/dist/pipelines/index.js +41 -36
- package/dist/pipelines/index.js.map +1 -1
- package/dist/pipelines/request.d.ts.map +1 -1
- package/dist/projections/execution.d.ts.map +1 -1
- package/dist/projections/internal.js +39 -32
- package/dist/projections/internal.js.map +1 -1
- package/dist/projections/run-dispatch.d.ts.map +1 -1
- package/dist/queues/in-memory.d.ts +3 -2
- package/dist/queues/in-memory.d.ts.map +1 -1
- package/dist/queues/index.d.ts +3 -1
- package/dist/queues/index.d.ts.map +1 -1
- package/dist/queues/index.js +1 -1
- package/dist/queues/types.d.ts +15 -3
- package/dist/queues/types.d.ts.map +1 -1
- package/dist/rules/execution.d.ts.map +1 -1
- package/dist/runtime/create.d.ts +7 -4
- package/dist/runtime/create.d.ts.map +1 -1
- package/dist/runtime/definitions.d.ts +4 -2
- package/dist/runtime/definitions.d.ts.map +1 -1
- package/dist/runtime/host.d.ts +5 -2
- package/dist/runtime/host.d.ts.map +1 -1
- package/dist/runtime/internal.d.ts +1 -0
- package/dist/runtime/internal.d.ts.map +1 -1
- package/dist/runtime/resolve-definitions.d.ts +4 -2
- package/dist/runtime/resolve-definitions.d.ts.map +1 -1
- package/dist/runtime/sixb.d.ts +8 -2
- package/dist/runtime/sixb.d.ts.map +1 -1
- package/dist/runtime/types.d.ts +3 -0
- package/dist/runtime/types.d.ts.map +1 -1
- package/dist/schedules/execution.d.ts +2 -1
- package/dist/schedules/execution.d.ts.map +1 -1
- package/dist/security/every.d.ts +4 -4
- package/dist/security/every.d.ts.map +1 -1
- package/dist/security/grants.d.ts +12 -6
- package/dist/security/grants.d.ts.map +1 -1
- package/dist/security/index.d.ts +1 -1
- package/dist/security/index.d.ts.map +1 -1
- package/dist/security/registry.d.ts +2 -1
- package/dist/security/registry.d.ts.map +1 -1
- package/dist/security/types.d.ts +19 -5
- package/dist/security/types.d.ts.map +1 -1
- package/dist/security/validation.d.ts +6 -2
- package/dist/security/validation.d.ts.map +1 -1
- package/dist/shares/access-plan.d.ts +22 -0
- package/dist/shares/access-plan.d.ts.map +1 -0
- package/dist/shares/builders.d.ts +14 -0
- package/dist/shares/builders.d.ts.map +1 -0
- package/dist/shares/compiler.d.ts +14 -0
- package/dist/shares/compiler.d.ts.map +1 -0
- package/dist/shares/errors.d.ts +4 -0
- package/dist/shares/errors.d.ts.map +1 -0
- package/dist/shares/execution.d.ts +57 -0
- package/dist/shares/execution.d.ts.map +1 -0
- package/dist/shares/index.d.ts +10 -0
- package/dist/shares/index.d.ts.map +1 -0
- package/dist/shares/internal.d.ts +3 -0
- package/dist/shares/internal.d.ts.map +1 -0
- package/dist/shares/internal.js +239 -0
- package/dist/shares/internal.js.map +10 -0
- package/dist/shares/intersection.d.ts +9 -0
- package/dist/shares/intersection.d.ts.map +1 -0
- package/dist/shares/session-protocol.d.ts +41 -0
- package/dist/shares/session-protocol.d.ts.map +1 -0
- package/dist/shares/types.d.ts +51 -0
- package/dist/shares/types.d.ts.map +1 -0
- package/dist/shares/validation.d.ts +11 -0
- package/dist/shares/validation.d.ts.map +1 -0
- package/dist/storage/action-runs/failure.js +3 -3
- package/dist/storage/action-runs/provider.js +2 -2
- package/dist/storage/agents/errors.d.ts +1 -1
- package/dist/storage/agents/errors.d.ts.map +1 -1
- package/dist/storage/agents/in-memory.d.ts +3 -2
- package/dist/storage/agents/in-memory.d.ts.map +1 -1
- package/dist/storage/agents/index.d.ts +1 -1
- package/dist/storage/agents/index.d.ts.map +1 -1
- package/dist/storage/agents/provider.d.ts +11 -4
- package/dist/storage/agents/provider.d.ts.map +1 -1
- package/dist/storage/agents/provider.js +18 -15
- package/dist/storage/agents/provider.js.map +1 -1
- package/dist/storage/agents/types.d.ts +65 -17
- package/dist/storage/agents/types.d.ts.map +1 -1
- package/dist/storage/ai-cost/analytics.d.ts +2 -1
- package/dist/storage/ai-cost/analytics.d.ts.map +1 -1
- package/dist/storage/ai-cost/codec.d.ts +3 -2
- package/dist/storage/ai-cost/codec.d.ts.map +1 -1
- package/dist/storage/ai-cost/groups.d.ts +51 -0
- package/dist/storage/ai-cost/groups.d.ts.map +1 -0
- package/dist/storage/ai-cost/in-memory.d.ts +11 -1
- package/dist/storage/ai-cost/in-memory.d.ts.map +1 -1
- package/dist/storage/ai-cost/index.d.ts +1 -1
- package/dist/storage/ai-cost/index.d.ts.map +1 -1
- package/dist/storage/ai-cost/provider.d.ts +2 -0
- package/dist/storage/ai-cost/provider.d.ts.map +1 -1
- package/dist/storage/ai-cost/provider.js +29 -13
- package/dist/storage/ai-cost/provider.js.map +3 -3
- package/dist/storage/ai-cost/types.d.ts +64 -15
- package/dist/storage/ai-cost/types.d.ts.map +1 -1
- package/dist/storage/ai-cost/validation.d.ts +2 -1
- package/dist/storage/ai-cost/validation.d.ts.map +1 -1
- package/dist/storage/ai-limits/enforcement.d.ts +14 -0
- package/dist/storage/ai-limits/enforcement.d.ts.map +1 -0
- package/dist/storage/ai-limits/enforcement.js +21 -0
- package/dist/storage/ai-limits/enforcement.js.map +9 -0
- package/dist/storage/ai-limits/errors.d.ts +8 -0
- package/dist/storage/ai-limits/errors.d.ts.map +1 -0
- package/dist/storage/ai-limits/in-memory.d.ts +78 -0
- package/dist/storage/ai-limits/in-memory.d.ts.map +1 -0
- package/dist/storage/ai-limits/index.d.ts +7 -0
- package/dist/storage/ai-limits/index.d.ts.map +1 -0
- package/dist/storage/ai-limits/period.d.ts +4 -0
- package/dist/storage/ai-limits/period.d.ts.map +1 -0
- package/dist/storage/ai-limits/provider.d.ts +85 -0
- package/dist/storage/ai-limits/provider.d.ts.map +1 -0
- package/dist/storage/ai-limits/provider.js +62 -0
- package/dist/storage/ai-limits/provider.js.map +9 -0
- package/dist/storage/ai-limits/types.d.ts +175 -0
- package/dist/storage/ai-limits/types.d.ts.map +1 -0
- package/dist/storage/ai-usage/in-memory.d.ts +4 -0
- package/dist/storage/ai-usage/in-memory.d.ts.map +1 -1
- package/dist/storage/ai-usage/record.d.ts.map +1 -1
- package/dist/storage/ai-usage/types.d.ts +6 -2
- package/dist/storage/ai-usage/types.d.ts.map +1 -1
- package/dist/storage/auth/errors.d.ts +1 -1
- package/dist/storage/auth/errors.d.ts.map +1 -1
- package/dist/storage/auth/in-memory/auth-storage.d.ts +4 -1
- package/dist/storage/auth/in-memory/auth-storage.d.ts.map +1 -1
- package/dist/storage/auth/in-memory/device-authorizations.d.ts +29 -0
- package/dist/storage/auth/in-memory/device-authorizations.d.ts.map +1 -0
- package/dist/storage/auth/in-memory/shared.d.ts +3 -1
- package/dist/storage/auth/in-memory/shared.d.ts.map +1 -1
- package/dist/storage/auth/index.d.ts +2 -1
- package/dist/storage/auth/index.d.ts.map +1 -1
- package/dist/storage/auth/types.d.ts +66 -0
- package/dist/storage/auth/types.d.ts.map +1 -1
- package/dist/storage/connector-connections/provider.js +2 -2
- package/dist/storage/executions/in-memory.d.ts +3 -0
- package/dist/storage/executions/in-memory.d.ts.map +1 -1
- package/dist/storage/executions/provider.d.ts +4 -1
- package/dist/storage/executions/provider.d.ts.map +1 -1
- package/dist/storage/executions/provider.js +23 -3
- package/dist/storage/executions/provider.js.map +3 -3
- package/dist/storage/executions/run-link.d.ts +14 -2
- package/dist/storage/executions/run-link.d.ts.map +1 -1
- package/dist/storage/executions/validation.d.ts +6 -0
- package/dist/storage/executions/validation.d.ts.map +1 -1
- package/dist/storage/in-memory/index.d.ts +12 -0
- package/dist/storage/in-memory/index.d.ts.map +1 -1
- package/dist/storage/index.d.ts +15 -6
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/index.js +78 -36
- package/dist/storage/index.js.map +1 -1
- package/dist/storage/objects/execution-limits.d.ts +25 -0
- package/dist/storage/objects/execution-limits.d.ts.map +1 -0
- package/dist/storage/objects/guard.d.ts +16 -0
- package/dist/storage/objects/guard.d.ts.map +1 -0
- package/dist/storage/objects/in-memory/index.d.ts +3 -0
- package/dist/storage/objects/in-memory/index.d.ts.map +1 -0
- package/dist/storage/objects/in-memory/keys.d.ts +10 -0
- package/dist/storage/objects/in-memory/keys.d.ts.map +1 -0
- package/dist/storage/objects/in-memory/query.d.ts +31 -0
- package/dist/storage/objects/in-memory/query.d.ts.map +1 -0
- package/dist/storage/objects/in-memory/read-scope.d.ts +18 -0
- package/dist/storage/objects/in-memory/read-scope.d.ts.map +1 -0
- package/dist/storage/objects/in-memory/read-source.d.ts +10 -0
- package/dist/storage/objects/in-memory/read-source.d.ts.map +1 -0
- package/dist/storage/objects/in-memory/selected-reader.d.ts +9 -0
- package/dist/storage/objects/in-memory/selected-reader.d.ts.map +1 -0
- package/dist/storage/objects/{in-memory.d.ts → in-memory/storage.d.ts} +13 -10
- package/dist/storage/objects/in-memory/storage.d.ts.map +1 -0
- package/dist/storage/objects/index.d.ts +4 -1
- package/dist/storage/objects/index.d.ts.map +1 -1
- package/dist/storage/objects/keys.d.ts +1 -1
- package/dist/storage/objects/keys.d.ts.map +1 -1
- package/dist/storage/objects/read-scope.d.ts +25 -0
- package/dist/storage/objects/read-scope.d.ts.map +1 -0
- package/dist/storage/objects/types.d.ts +114 -22
- package/dist/storage/objects/types.d.ts.map +1 -1
- package/dist/storage/ontology/provider.js +3 -3
- package/dist/storage/operation-scope.d.ts +3 -0
- package/dist/storage/operation-scope.d.ts.map +1 -1
- package/dist/storage/operation-scope.js +4 -2
- package/dist/storage/operation-scope.js.map +1 -1
- package/dist/storage/pipeline-runs/provider.js +2 -2
- package/dist/storage/projection-runs/provider.js +4 -4
- package/dist/storage/share-grants/errors.d.ts +8 -0
- package/dist/storage/share-grants/errors.d.ts.map +1 -0
- package/dist/storage/share-grants/in-memory.d.ts +11 -0
- package/dist/storage/share-grants/in-memory.d.ts.map +1 -0
- package/dist/storage/share-grants/index.d.ts +5 -0
- package/dist/storage/share-grants/index.d.ts.map +1 -0
- package/dist/storage/share-grants/provider.d.ts +4 -0
- package/dist/storage/share-grants/provider.d.ts.map +1 -0
- package/dist/storage/share-grants/provider.js +24 -0
- package/dist/storage/share-grants/provider.js.map +9 -0
- package/dist/storage/share-grants/record.d.ts +11 -0
- package/dist/storage/share-grants/record.d.ts.map +1 -0
- package/dist/storage/share-grants/types.d.ts +97 -0
- package/dist/storage/share-grants/types.d.ts.map +1 -0
- package/dist/storage/share-sessions/errors.d.ts +8 -0
- package/dist/storage/share-sessions/errors.d.ts.map +1 -0
- package/dist/storage/share-sessions/in-memory.d.ts +14 -0
- package/dist/storage/share-sessions/in-memory.d.ts.map +1 -0
- package/dist/storage/share-sessions/index.d.ts +5 -0
- package/dist/storage/share-sessions/index.d.ts.map +1 -0
- package/dist/storage/share-sessions/provider.d.ts +3 -0
- package/dist/storage/share-sessions/provider.d.ts.map +1 -0
- package/dist/storage/share-sessions/provider.js +20 -0
- package/dist/storage/share-sessions/provider.js.map +9 -0
- package/dist/storage/share-sessions/record.d.ts +8 -0
- package/dist/storage/share-sessions/record.d.ts.map +1 -0
- package/dist/storage/share-sessions/types.d.ts +50 -0
- package/dist/storage/share-sessions/types.d.ts.map +1 -0
- package/dist/storage/sync-runs/provider.js +2 -2
- package/dist/storage/transaction.d.ts +2 -1
- package/dist/storage/transaction.d.ts.map +1 -1
- package/dist/storage/types.d.ts +13 -1
- package/dist/storage/types.d.ts.map +1 -1
- package/dist/storage/webhook-runs/provider.js +2 -2
- package/dist/storage/workflow-runs/provider.d.ts +1 -1
- package/dist/storage/workflow-runs/provider.js +14 -12
- package/dist/storage/workflow-runs/provider.js.map +1 -1
- package/dist/storage/workflow-runs/types.d.ts +5 -4
- package/dist/storage/workflow-runs/types.d.ts.map +1 -1
- package/dist/syncs/execution.d.ts.map +1 -1
- package/dist/syncs/index.js +41 -36
- package/dist/syncs/index.js.map +1 -1
- package/dist/syncs/request.d.ts.map +1 -1
- package/dist/testing/agent-execution.d.ts +3 -1
- package/dist/testing/agent-execution.d.ts.map +1 -1
- package/dist/testing/agent-storage-contract.d.ts.map +1 -1
- package/dist/testing/ai-cost-storage-contract.d.ts.map +1 -1
- package/dist/testing/ai-limit-storage-contract.d.ts +18 -0
- package/dist/testing/ai-limit-storage-contract.d.ts.map +1 -0
- package/dist/testing/ai-model-call-groups-contract.d.ts +6 -0
- package/dist/testing/ai-model-call-groups-contract.d.ts.map +1 -0
- package/dist/testing/ai-usage-storage-contract.d.ts.map +1 -1
- package/dist/testing/auth-storage-contract.d.ts.map +1 -1
- package/dist/testing/dataset-sequence-contract.d.ts +4 -0
- package/dist/testing/dataset-sequence-contract.d.ts.map +1 -0
- package/dist/testing/effective-storage-contract.d.ts.map +1 -1
- package/dist/testing/execution-storage-contract.d.ts +4 -0
- package/dist/testing/execution-storage-contract.d.ts.map +1 -1
- package/dist/testing/index.d.ts +5 -0
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +5392 -2070
- package/dist/testing/index.js.map +21 -15
- package/dist/testing/lake-merge-storage-contract.d.ts +1 -0
- package/dist/testing/lake-merge-storage-contract.d.ts.map +1 -1
- package/dist/testing/lake-storage-contract.d.ts.map +1 -1
- package/dist/testing/object-read-scope-contract.d.ts +22 -0
- package/dist/testing/object-read-scope-contract.d.ts.map +1 -0
- package/dist/testing/queues-contract.d.ts.map +1 -1
- package/dist/testing/share-grant-storage-contract.d.ts +10 -0
- package/dist/testing/share-grant-storage-contract.d.ts.map +1 -0
- package/dist/testing/share-session-storage-contract.d.ts +9 -0
- package/dist/testing/share-session-storage-contract.d.ts.map +1 -0
- package/dist/webhooks/internal.js +36 -29
- package/dist/webhooks/internal.js.map +2 -2
- package/dist/workers/index.js +2 -2
- package/dist/workflows/agent-step-identity.d.ts +3 -0
- package/dist/workflows/agent-step-identity.d.ts.map +1 -0
- package/dist/workflows/builders.d.ts +2 -3
- package/dist/workflows/builders.d.ts.map +1 -1
- package/dist/workflows/execution.d.ts +1 -1
- package/dist/workflows/execution.d.ts.map +1 -1
- package/dist/workflows/failure.d.ts +1 -1
- package/dist/workflows/failure.d.ts.map +1 -1
- package/dist/workflows/index.d.ts +3 -2
- package/dist/workflows/index.d.ts.map +1 -1
- package/dist/workflows/index.js +63 -48
- package/dist/workflows/index.js.map +1 -1
- package/dist/workflows/request.d.ts.map +1 -1
- package/dist/workflows/types.d.ts +26 -11
- package/dist/workflows/types.d.ts.map +1 -1
- package/dist/workflows/validation.d.ts +7 -1
- package/dist/workflows/validation.d.ts.map +1 -1
- package/package.json +43 -4
- package/src/actions/delegated-admission.ts +72 -0
- package/src/actions/descriptor.ts +58 -0
- package/src/actions/execution.ts +99 -24
- package/src/actions/request.ts +136 -19
- package/src/actions/run-authorization.ts +53 -0
- package/src/actions/run-dispatch.ts +8 -1
- package/src/agents/adapters.ts +60 -456
- package/src/agents/authority.ts +215 -34
- package/src/agents/builders.ts +3 -50
- package/src/agents/context-compaction.ts +4 -0
- package/src/agents/context-resolution.ts +1 -4
- package/src/agents/dispatch.ts +59 -2
- package/src/agents/errors.ts +4 -11
- package/src/agents/execution.ts +65 -56
- package/src/agents/identity.ts +4 -0
- package/src/agents/ids.ts +16 -1
- package/src/agents/index.ts +23 -30
- package/src/agents/message.ts +20 -12
- package/src/agents/model-loop.ts +1071 -0
- package/src/agents/reference.ts +7 -0
- package/src/agents/request.ts +157 -77
- package/src/agents/retired-config.ts +20 -0
- package/src/agents/streams.ts +45 -19
- package/src/agents/tool-catalog.ts +21 -0
- package/src/agents/tool-definition.ts +9 -5
- package/src/agents/types.ts +39 -81
- package/src/agents/validation.ts +11 -216
- package/src/ai-usage/execution.ts +189 -0
- package/src/ai-usage/index.ts +15 -0
- package/src/authorization/decision.ts +54 -22
- package/src/authorization/grant-kinds.ts +72 -15
- package/src/authorization/index.ts +2 -0
- package/src/authorization/resolve.ts +12 -5
- package/src/authorization/types.ts +7 -5
- package/src/bootstrap/discovery.ts +3 -3
- package/src/bootstrap/ontology-type-manifest.ts +12 -6
- package/src/datasets/builders.ts +23 -2
- package/src/datasets/changes.ts +16 -4
- package/src/datasets/execution.ts +76 -5
- package/src/datasets/index.ts +1 -0
- package/src/datasets/sequence.ts +77 -0
- package/src/datasets/types.ts +1 -0
- package/src/datasets/validation.ts +26 -0
- package/src/datasets/write.ts +240 -0
- package/src/error-reporting/types.ts +4 -2
- package/src/errors/catalog.ts +8 -0
- package/src/events/execution.ts +57 -7
- package/src/events/types/datasets.ts +2 -6
- package/src/execution/agent.ts +129 -25
- package/src/execution/authorization.ts +493 -83
- package/src/execution/authorized-object-reader.ts +695 -0
- package/src/execution/durable.ts +10 -2
- package/src/execution/index.ts +1 -0
- package/src/execution/request.ts +67 -14
- package/src/execution/scopes.ts +36 -6
- package/src/execution/types.ts +9 -1
- package/src/http/api-routes.ts +108 -0
- package/src/index.ts +72 -22
- package/src/json.ts +9 -0
- package/src/lake-storage/definition-updates.ts +9 -0
- package/src/lake-storage/errors.ts +6 -1
- package/src/lake-storage/in-memory.ts +53 -17
- package/src/lake-storage/index.ts +10 -1
- package/src/lake-storage/merge-validation.ts +12 -2
- package/src/lake-storage/merge.ts +40 -2
- package/src/lake-storage/source-ordering.ts +95 -0
- package/src/lake-storage/sql-transforms.ts +2 -1
- package/src/lake-storage/types.ts +10 -5
- package/src/lake-storage/version-inputs.ts +14 -0
- package/src/models/catalog.ts +137 -0
- package/src/models/definitions.ts +202 -0
- package/src/models/errors.ts +83 -0
- package/src/models/events.ts +198 -0
- package/src/models/index.ts +89 -71
- package/src/models/language-model.ts +143 -0
- package/src/models/messages.ts +78 -0
- package/src/models/pricing.ts +390 -0
- package/src/models/rate-card.ts +101 -0
- package/src/models/tools.ts +29 -0
- package/src/objects/authorized-ontology-view.ts +512 -0
- package/src/objects/execution.ts +98 -143
- package/src/objects/link/authorization.ts +3 -2
- package/src/objects/query/executor.ts +45 -34
- package/src/objects/query/links.ts +84 -25
- package/src/objects/query/selected-read-admission.ts +310 -0
- package/src/objects/query/validate.ts +353 -36
- package/src/objects/sdk/object-handle.ts +2 -8
- package/src/objects/sdk/object-set.ts +10 -11
- package/src/objects/sdk/runtime-query-executor.ts +8 -28
- package/src/objects/sdk/telemetry-channel.ts +11 -7
- package/src/objects/service/list-service.ts +15 -29
- package/src/objects/telemetry/history.ts +297 -17
- package/src/objects/telemetry/index.ts +2 -2
- package/src/objects/telemetry/workload.ts +79 -0
- package/src/ontology/index.ts +7 -1
- package/src/ontology/inference/index.ts +4 -1
- package/src/ontology/internal.ts +0 -1
- package/src/ontology/json-schema.ts +13 -12
- package/src/ontology/link-path-selection.ts +193 -0
- package/src/ontology/refs.ts +19 -0
- package/src/ontology/tokens.ts +15 -8
- package/src/pipelines/execution.ts +30 -7
- package/src/pipelines/request.ts +5 -0
- package/src/projections/execution.ts +72 -11
- package/src/projections/run-dispatch.ts +6 -12
- package/src/queues/in-memory.ts +5 -0
- package/src/queues/index.ts +11 -0
- package/src/queues/types.ts +20 -3
- package/src/rules/execution.ts +20 -8
- package/src/runtime/create.ts +11 -5
- package/src/runtime/definitions.ts +4 -2
- package/src/runtime/host.ts +28 -8
- package/src/runtime/internal.ts +1 -0
- package/src/runtime/resolve-definitions.ts +22 -36
- package/src/runtime/sixb.ts +29 -10
- package/src/runtime/types.ts +3 -0
- package/src/schedules/execution.ts +24 -2
- package/src/security/every.ts +4 -4
- package/src/security/grants.ts +100 -14
- package/src/security/index.ts +3 -0
- package/src/security/registry.ts +9 -5
- package/src/security/types.ts +23 -4
- package/src/security/validation.ts +33 -9
- package/src/shares/access-plan.ts +225 -0
- package/src/shares/builders.ts +381 -0
- package/src/shares/compiler.ts +359 -0
- package/src/shares/errors.ts +3 -0
- package/src/shares/execution.ts +394 -0
- package/src/shares/index.ts +28 -0
- package/src/shares/internal.ts +9 -0
- package/src/shares/intersection.ts +178 -0
- package/src/shares/session-protocol.ts +258 -0
- package/src/shares/types.ts +76 -0
- package/src/shares/validation.ts +40 -0
- package/src/storage/agents/errors.ts +1 -0
- package/src/storage/agents/in-memory.ts +121 -11
- package/src/storage/agents/index.ts +7 -0
- package/src/storage/agents/provider.ts +150 -6
- package/src/storage/agents/types.ts +73 -16
- package/src/storage/ai-cost/analytics.ts +63 -6
- package/src/storage/ai-cost/codec.ts +37 -12
- package/src/storage/ai-cost/groups.ts +248 -0
- package/src/storage/ai-cost/in-memory.ts +42 -0
- package/src/storage/ai-cost/index.ts +6 -0
- package/src/storage/ai-cost/provider.ts +7 -0
- package/src/storage/ai-cost/types.ts +76 -14
- package/src/storage/ai-cost/validation.ts +147 -17
- package/src/storage/ai-limits/enforcement.ts +68 -0
- package/src/storage/ai-limits/errors.ts +23 -0
- package/src/storage/ai-limits/in-memory.ts +671 -0
- package/src/storage/ai-limits/index.ts +31 -0
- package/src/storage/ai-limits/period.ts +11 -0
- package/src/storage/ai-limits/provider.ts +430 -0
- package/src/storage/ai-limits/types.ts +195 -0
- package/src/storage/ai-usage/in-memory.ts +13 -0
- package/src/storage/ai-usage/record.ts +17 -0
- package/src/storage/ai-usage/types.ts +6 -2
- package/src/storage/auth/errors.ts +6 -0
- package/src/storage/auth/in-memory/auth-storage.ts +69 -0
- package/src/storage/auth/in-memory/device-authorizations.ts +145 -0
- package/src/storage/auth/in-memory/shared.ts +7 -0
- package/src/storage/auth/index.ts +7 -0
- package/src/storage/auth/types.ts +73 -0
- package/src/storage/executions/in-memory.ts +9 -1
- package/src/storage/executions/provider.ts +30 -1
- package/src/storage/executions/run-link.ts +45 -6
- package/src/storage/executions/validation.ts +82 -7
- package/src/storage/in-memory/index.ts +69 -6
- package/src/storage/index.ts +102 -1
- package/src/storage/objects/execution-limits.ts +283 -0
- package/src/storage/objects/guard.ts +55 -0
- package/src/storage/objects/in-memory/index.ts +2 -0
- package/src/storage/objects/in-memory/keys.ts +46 -0
- package/src/storage/objects/in-memory/query.ts +754 -0
- package/src/storage/objects/in-memory/read-scope.ts +211 -0
- package/src/storage/objects/in-memory/read-source.ts +10 -0
- package/src/storage/objects/in-memory/selected-reader.ts +252 -0
- package/src/storage/objects/in-memory/storage.ts +589 -0
- package/src/storage/objects/index.ts +21 -0
- package/src/storage/objects/keys.ts +1 -1
- package/src/storage/objects/read-scope.ts +672 -0
- package/src/storage/objects/types.ts +123 -19
- package/src/storage/operation-scope.ts +16 -0
- package/src/storage/share-grants/errors.ts +14 -0
- package/src/storage/share-grants/in-memory.ts +107 -0
- package/src/storage/share-grants/index.ts +14 -0
- package/src/storage/share-grants/provider.ts +11 -0
- package/src/storage/share-grants/record.ts +347 -0
- package/src/storage/share-grants/types.ts +112 -0
- package/src/storage/share-sessions/errors.ts +14 -0
- package/src/storage/share-sessions/in-memory.ts +105 -0
- package/src/storage/share-sessions/index.ts +11 -0
- package/src/storage/share-sessions/provider.ts +9 -0
- package/src/storage/share-sessions/record.ts +176 -0
- package/src/storage/share-sessions/types.ts +57 -0
- package/src/storage/transaction.ts +14 -2
- package/src/storage/types.ts +64 -0
- package/src/storage/workflow-runs/in-memory.ts +3 -3
- package/src/storage/workflow-runs/provider.ts +2 -2
- package/src/storage/workflow-runs/types.ts +6 -3
- package/src/syncs/execution.ts +25 -5
- package/src/syncs/request.ts +5 -0
- package/src/testing/agent-execution.ts +40 -28
- package/src/testing/agent-storage-contract.ts +249 -28
- package/src/testing/ai-cost-storage-contract.ts +96 -8
- package/src/testing/ai-limit-storage-contract.ts +1134 -0
- package/src/testing/ai-model-call-groups-contract.ts +353 -0
- package/src/testing/ai-usage-storage-contract.ts +31 -0
- package/src/testing/auth-storage-contract.ts +85 -0
- package/src/testing/dataset-sequence-contract.ts +373 -0
- package/src/testing/effective-storage-contract.ts +34 -0
- package/src/testing/execution-storage-contract.ts +81 -2
- package/src/testing/index.ts +26 -0
- package/src/testing/lake-merge-storage-contract.ts +3 -0
- package/src/testing/lake-storage-contract.ts +58 -0
- package/src/testing/object-read-scope-contract.ts +939 -0
- package/src/testing/queues-contract.ts +36 -1
- package/src/testing/share-grant-storage-contract.ts +325 -0
- package/src/testing/share-session-storage-contract.ts +235 -0
- package/src/workflows/agent-step-identity.ts +4 -0
- package/src/workflows/builders.ts +95 -9
- package/src/workflows/execution.ts +55 -16
- package/src/workflows/failure.ts +2 -2
- package/src/workflows/index.ts +3 -0
- package/src/workflows/request.ts +5 -0
- package/src/workflows/types.ts +23 -11
- package/src/workflows/validation.ts +100 -7
- package/dist/chunk-1e8m6yn3.js.map +0 -37
- package/dist/chunk-1g8negke.js.map +0 -11
- package/dist/chunk-4gz41why.js +0 -72
- package/dist/chunk-4gz41why.js.map +0 -11
- package/dist/chunk-5sxb1168.js.map +0 -34
- package/dist/chunk-6gjqgd3d.js.map +0 -11
- package/dist/chunk-819wnjz8.js.map +0 -12
- package/dist/chunk-a31h57d5.js.map +0 -13
- package/dist/chunk-a44d5zgd.js +0 -556
- package/dist/chunk-a44d5zgd.js.map +0 -16
- package/dist/chunk-ckxfnx7f.js.map +0 -13
- package/dist/chunk-dm72y8wt.js.map +0 -10
- package/dist/chunk-drjqm1aa.js.map +0 -15
- package/dist/chunk-dy311asx.js.map +0 -14
- package/dist/chunk-f6erf2vv.js.map +0 -10
- package/dist/chunk-f83ka50g.js.map +0 -23
- package/dist/chunk-fe5ev6mr.js +0 -55
- package/dist/chunk-fe5ev6mr.js.map +0 -11
- package/dist/chunk-h9kxd41f.js.map +0 -11
- package/dist/chunk-hceck7dq.js +0 -137
- package/dist/chunk-hceck7dq.js.map +0 -10
- package/dist/chunk-md8k0r54.js.map +0 -14
- package/dist/chunk-n4spznws.js.map +0 -11
- package/dist/chunk-nva1xkjz.js.map +0 -46
- package/dist/chunk-qewtks41.js.map +0 -11
- package/dist/chunk-t0jjkep3.js.map +0 -10
- package/dist/chunk-t624af60.js.map +0 -56
- package/dist/chunk-t8t39h7v.js.map +0 -10
- package/dist/chunk-t9xghkva.js +0 -28
- package/dist/chunk-t9xghkva.js.map +0 -10
- package/dist/chunk-x2yw73hy.js.map +0 -10
- package/dist/chunk-xc7hq65b.js.map +0 -10
- package/dist/storage/objects/in-memory.d.ts.map +0 -1
- package/src/storage/objects/in-memory.ts +0 -1241
- /package/dist/{chunk-zqysyfjt.js.map → chunk-08m3b6w8.js.map} +0 -0
- /package/dist/{chunk-z3zp0bj1.js.map → chunk-407j3msh.js.map} +0 -0
- /package/dist/{chunk-rhrbz7d4.js.map → chunk-4a849fr1.js.map} +0 -0
- /package/dist/{chunk-cy0n5dms.js.map → chunk-4jjp5k14.js.map} +0 -0
- /package/dist/{chunk-ezake7g1.js.map → chunk-5ntny1qx.js.map} +0 -0
- /package/dist/{chunk-72q2y8hn.js.map → chunk-8tsf6dmc.js.map} +0 -0
- /package/dist/{chunk-vybf6pkp.js.map → chunk-dbc80ad7.js.map} +0 -0
- /package/dist/{chunk-nkbfrt0c.js.map → chunk-f26bck4t.js.map} +0 -0
- /package/dist/{chunk-dsrkgtnh.js.map → chunk-jq43kdvk.js.map} +0 -0
- /package/dist/{chunk-wtmzkcht.js.map → chunk-k34z5rvh.js.map} +0 -0
- /package/dist/{chunk-htq0qh7z.js.map → chunk-ka3a2ft3.js.map} +0 -0
- /package/dist/{chunk-f2rt4vkh.js.map → chunk-n2w475r0.js.map} +0 -0
- /package/dist/{chunk-bhxaq2nn.js.map → chunk-qw9gvjv5.js.map} +0 -0
- /package/dist/{chunk-dysw7nsm.js.map → chunk-rv2hkwwa.js.map} +0 -0
- /package/dist/{chunk-ghteq96b.js.map → chunk-s5y30bc9.js.map} +0 -0
- /package/dist/{chunk-xkthy56g.js.map → chunk-w1tvjszy.js.map} +0 -0
- /package/dist/{chunk-8b55ygje.js.map → chunk-w3e09qqk.js.map} +0 -0
- /package/dist/{chunk-62c7t4jc.js.map → chunk-wdage1eb.js.map} +0 -0
|
@@ -1,13 +1,24 @@
|
|
|
1
1
|
// @bun
|
|
2
|
+
import {
|
|
3
|
+
compileSelectedObjectReadScope
|
|
4
|
+
} from "./chunk-r8jrnexe.js";
|
|
2
5
|
import {
|
|
3
6
|
resolveSemanticType
|
|
4
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-h0k55pc7.js";
|
|
5
8
|
import {
|
|
6
9
|
createSixbError
|
|
7
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-2xns679x.js";
|
|
8
11
|
import {
|
|
9
12
|
compareStrings
|
|
10
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-n6jxh8sw.js";
|
|
14
|
+
|
|
15
|
+
// src/execution/authorization.ts
|
|
16
|
+
import { isDeepStrictEqual } from "util";
|
|
17
|
+
|
|
18
|
+
// src/agents/identity.ts
|
|
19
|
+
function agentServiceAccountId(actorId) {
|
|
20
|
+
return `svc_agent_${actorId}`;
|
|
21
|
+
}
|
|
11
22
|
|
|
12
23
|
// src/authorization/grant-kinds.ts
|
|
13
24
|
var GRANT_KINDS = {
|
|
@@ -42,6 +53,11 @@ var GRANT_KINDS = {
|
|
|
42
53
|
subject: "action",
|
|
43
54
|
fix: "Add it to 'actions/' or pass it to createSixb({ actions })."
|
|
44
55
|
},
|
|
56
|
+
"share:share": {
|
|
57
|
+
universeKey: "shareIds",
|
|
58
|
+
subject: "share",
|
|
59
|
+
fix: "Add it to 'shares/' or pass it to createSixb({ shares })."
|
|
60
|
+
},
|
|
45
61
|
"run:workflow": {
|
|
46
62
|
universeKey: "workflowIds",
|
|
47
63
|
subject: "workflow",
|
|
@@ -58,22 +74,33 @@ var GRANT_KINDS = {
|
|
|
58
74
|
fix: "Add it to 'pipelines/' or pass it to createSixb({ pipelines })."
|
|
59
75
|
},
|
|
60
76
|
"run:agent": {
|
|
61
|
-
|
|
77
|
+
singleton: true,
|
|
62
78
|
subject: "agent",
|
|
63
|
-
fix: "
|
|
79
|
+
fix: "Configure models.language and use the exported agent reference in can.run(agent)."
|
|
64
80
|
},
|
|
65
81
|
"observe:logs": {
|
|
66
82
|
universeKey: "observableIds",
|
|
67
83
|
subject: "observability surface",
|
|
68
84
|
fix: 'Use can.observe("logs").'
|
|
69
85
|
},
|
|
86
|
+
"observe:aiUsage": {
|
|
87
|
+
universeKey: "observableIds",
|
|
88
|
+
subject: "observability surface",
|
|
89
|
+
fix: "Use can.observe(agent.usage)."
|
|
90
|
+
},
|
|
70
91
|
"manage:connector": {
|
|
71
92
|
universeKey: "connectorIds",
|
|
72
93
|
subject: "connector",
|
|
73
94
|
fix: "Add it to 'connectors/' or pass it to createSixb({ connectors })."
|
|
95
|
+
},
|
|
96
|
+
"manage:aiUsage": {
|
|
97
|
+
universeKey: "manageableIds",
|
|
98
|
+
subject: "management surface",
|
|
99
|
+
fix: "Use can.manage(agent.usage)."
|
|
74
100
|
}
|
|
75
101
|
};
|
|
76
102
|
var GRANT_KIND_KEYS = Object.keys(GRANT_KINDS);
|
|
103
|
+
var TARGETED_GRANT_KIND_KEYS = GRANT_KIND_KEYS.filter((kind) => kind !== "run:agent");
|
|
77
104
|
function grantKindOf(grant) {
|
|
78
105
|
switch (grant.capability) {
|
|
79
106
|
case "access":
|
|
@@ -86,20 +113,273 @@ function grantKindOf(grant) {
|
|
|
86
113
|
return "append:telemetry";
|
|
87
114
|
case "apply":
|
|
88
115
|
return "apply:action";
|
|
116
|
+
case "share":
|
|
117
|
+
return "share:share";
|
|
89
118
|
case "run":
|
|
90
119
|
return `run:${grant.target}`;
|
|
91
120
|
case "observe":
|
|
92
|
-
return
|
|
121
|
+
return `observe:${grant.target}`;
|
|
93
122
|
case "manage":
|
|
94
|
-
return
|
|
123
|
+
return `manage:${grant.target}`;
|
|
95
124
|
}
|
|
96
125
|
}
|
|
97
126
|
function emptyGrantSets() {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
127
|
+
return {
|
|
128
|
+
"access:application": new Set,
|
|
129
|
+
"view:object": new Set,
|
|
130
|
+
"view:dataset": new Set,
|
|
131
|
+
"edit:object": new Set,
|
|
132
|
+
"append:telemetry": new Set,
|
|
133
|
+
"apply:action": new Set,
|
|
134
|
+
"share:share": new Set,
|
|
135
|
+
"run:workflow": new Set,
|
|
136
|
+
"run:sync": new Set,
|
|
137
|
+
"run:pipeline": new Set,
|
|
138
|
+
"run:agent": false,
|
|
139
|
+
"observe:logs": new Set,
|
|
140
|
+
"observe:aiUsage": new Set,
|
|
141
|
+
"manage:connector": new Set,
|
|
142
|
+
"manage:aiUsage": new Set
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// src/storage/objects/execution-limits.ts
|
|
147
|
+
var MAX_OBJECT_READ_FACETS = 16;
|
|
148
|
+
var MAX_OUTPUT_JSON_DEPTH = 64;
|
|
149
|
+
|
|
150
|
+
class ObjectReadLimitExceededError extends Error {
|
|
151
|
+
metric;
|
|
152
|
+
limit;
|
|
153
|
+
name = "ObjectReadLimitExceededError";
|
|
154
|
+
code = "object_read_limit_exceeded";
|
|
155
|
+
constructor(metric, limit) {
|
|
156
|
+
super(`[Sixb] Object read exceeded its ${metric} limit (${limit}).`);
|
|
157
|
+
this.metric = metric;
|
|
158
|
+
this.limit = limit;
|
|
101
159
|
}
|
|
102
|
-
|
|
160
|
+
}
|
|
161
|
+
function snapshotObjectReadExecutionLimits(limits) {
|
|
162
|
+
if (typeof limits !== "object" || limits === null) {
|
|
163
|
+
throw new Error("[Sixb] Object read execution limits must be provided.");
|
|
164
|
+
}
|
|
165
|
+
return Object.freeze({
|
|
166
|
+
maxTraversalFacts: positiveSafeInteger(limits.maxTraversalFacts, "maxTraversalFacts"),
|
|
167
|
+
maxOutputJsonBytes: positiveSafeInteger(limits.maxOutputJsonBytes, "maxOutputJsonBytes")
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
function assertObjectReadFacetCount(count) {
|
|
171
|
+
if (!Number.isSafeInteger(count) || count < 0 || count > MAX_OBJECT_READ_FACETS) {
|
|
172
|
+
throw new Error(`[Sixb] An object read supports between 0 and ${MAX_OBJECT_READ_FACETS} facets.`);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
function assertObjectReadOutputWithinLimit(value, limits) {
|
|
176
|
+
const fail = () => {
|
|
177
|
+
throw new ObjectReadLimitExceededError("outputJsonBytes", limits.maxOutputJsonBytes);
|
|
178
|
+
};
|
|
179
|
+
const stack = [];
|
|
180
|
+
let bytes = 0;
|
|
181
|
+
const addBytes = (count) => {
|
|
182
|
+
bytes += count;
|
|
183
|
+
if (bytes > limits.maxOutputJsonBytes)
|
|
184
|
+
fail();
|
|
185
|
+
};
|
|
186
|
+
const addPrimitiveBytes = (primitive) => {
|
|
187
|
+
switch (typeof primitive) {
|
|
188
|
+
case "string":
|
|
189
|
+
addBytes(jsonStringUtf8Length(primitive));
|
|
190
|
+
break;
|
|
191
|
+
case "number":
|
|
192
|
+
addBytes(Number.isFinite(primitive) ? Object.is(primitive, -0) ? 1 : String(primitive).length : 4);
|
|
193
|
+
break;
|
|
194
|
+
case "boolean":
|
|
195
|
+
addBytes(primitive ? 4 : 5);
|
|
196
|
+
break;
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
try {
|
|
200
|
+
JSON.stringify(value, function(key, current) {
|
|
201
|
+
const parent = isObject(this) ? this : undefined;
|
|
202
|
+
let parentFrameIndex = -1;
|
|
203
|
+
if (parent) {
|
|
204
|
+
for (let index = stack.length - 1;index >= 0; index -= 1) {
|
|
205
|
+
if (stack[index]?.value === parent) {
|
|
206
|
+
parentFrameIndex = index;
|
|
207
|
+
break;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
const isRoot = parentFrameIndex === -1;
|
|
212
|
+
if (isRoot) {
|
|
213
|
+
stack.length = 0;
|
|
214
|
+
} else {
|
|
215
|
+
stack.length = parentFrameIndex + 1;
|
|
216
|
+
}
|
|
217
|
+
const parentFrame = isRoot ? undefined : stack[parentFrameIndex];
|
|
218
|
+
const parentIsArray = Array.isArray(parent);
|
|
219
|
+
const unsupported = current === undefined || typeof current === "function" || typeof current === "symbol";
|
|
220
|
+
if (!isRoot) {
|
|
221
|
+
if (!parentIsArray && unsupported)
|
|
222
|
+
return current;
|
|
223
|
+
if (!parentFrame)
|
|
224
|
+
return fail();
|
|
225
|
+
if (parentFrame.serializedChildren > 0)
|
|
226
|
+
addBytes(1);
|
|
227
|
+
parentFrame.serializedChildren += 1;
|
|
228
|
+
if (!parentIsArray)
|
|
229
|
+
addBytes(jsonStringUtf8Length(key) + 1);
|
|
230
|
+
} else if (unsupported) {
|
|
231
|
+
return current;
|
|
232
|
+
}
|
|
233
|
+
if (parentIsArray && unsupported) {
|
|
234
|
+
addBytes(4);
|
|
235
|
+
return current;
|
|
236
|
+
}
|
|
237
|
+
if (isObject(current)) {
|
|
238
|
+
const special = inspectJsonSpecialObject(current);
|
|
239
|
+
switch (special.kind) {
|
|
240
|
+
case "primitive":
|
|
241
|
+
addPrimitiveBytes(special.value);
|
|
242
|
+
return special.value;
|
|
243
|
+
case "bigint":
|
|
244
|
+
throw new TypeError("BigInt is not JSON serializable");
|
|
245
|
+
case "raw":
|
|
246
|
+
addBytes(rawJsonUtf8Length(special.value));
|
|
247
|
+
return current;
|
|
248
|
+
case "ordinary":
|
|
249
|
+
break;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
switch (typeof current) {
|
|
253
|
+
case "string":
|
|
254
|
+
addPrimitiveBytes(current);
|
|
255
|
+
break;
|
|
256
|
+
case "number":
|
|
257
|
+
addPrimitiveBytes(current);
|
|
258
|
+
break;
|
|
259
|
+
case "boolean":
|
|
260
|
+
addPrimitiveBytes(current);
|
|
261
|
+
break;
|
|
262
|
+
case "bigint":
|
|
263
|
+
throw new TypeError("BigInt is not JSON serializable");
|
|
264
|
+
case "object":
|
|
265
|
+
if (current === null) {
|
|
266
|
+
addBytes(4);
|
|
267
|
+
break;
|
|
268
|
+
}
|
|
269
|
+
if (stack.some((frame) => frame.value === current)) {
|
|
270
|
+
throw new TypeError("Cyclic object value");
|
|
271
|
+
}
|
|
272
|
+
if (stack.length + 1 > MAX_OUTPUT_JSON_DEPTH)
|
|
273
|
+
fail();
|
|
274
|
+
addBytes(2);
|
|
275
|
+
stack.push({ value: current, serializedChildren: 0 });
|
|
276
|
+
break;
|
|
277
|
+
}
|
|
278
|
+
return current;
|
|
279
|
+
});
|
|
280
|
+
} catch (error) {
|
|
281
|
+
if (error instanceof ObjectReadLimitExceededError)
|
|
282
|
+
throw error;
|
|
283
|
+
if (error instanceof RangeError || error instanceof TypeError)
|
|
284
|
+
fail();
|
|
285
|
+
throw error;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
var jsonWithRawJson = JSON;
|
|
289
|
+
var isRawJson = jsonWithRawJson.isRawJSON?.bind(jsonWithRawJson);
|
|
290
|
+
var booleanValueOf = bindValueOf(Boolean.prototype.valueOf);
|
|
291
|
+
var numberValueOf = bindValueOf(Number.prototype.valueOf);
|
|
292
|
+
var stringValueOf = bindValueOf(String.prototype.valueOf);
|
|
293
|
+
var bigintValueOf = bindValueOf(BigInt.prototype.valueOf);
|
|
294
|
+
var toStringValue = String;
|
|
295
|
+
function inspectJsonSpecialObject(value) {
|
|
296
|
+
if (isRawJson?.(value)) {
|
|
297
|
+
const raw = value.rawJSON;
|
|
298
|
+
if (typeof raw !== "string")
|
|
299
|
+
return { kind: "ordinary" };
|
|
300
|
+
return { kind: "raw", value: raw };
|
|
301
|
+
}
|
|
302
|
+
const boolean = unbox(value, booleanValueOf);
|
|
303
|
+
if (boolean.matched)
|
|
304
|
+
return { kind: "primitive", value: boolean.value };
|
|
305
|
+
const number = unbox(value, numberValueOf);
|
|
306
|
+
if (number.matched)
|
|
307
|
+
return { kind: "primitive", value: +value };
|
|
308
|
+
const string = unbox(value, stringValueOf);
|
|
309
|
+
if (string.matched)
|
|
310
|
+
return { kind: "primitive", value: toStringValue(value) };
|
|
311
|
+
if (unbox(value, bigintValueOf).matched)
|
|
312
|
+
return { kind: "bigint" };
|
|
313
|
+
return { kind: "ordinary" };
|
|
314
|
+
}
|
|
315
|
+
function bindValueOf(unboxer) {
|
|
316
|
+
return Function.prototype.call.bind(unboxer);
|
|
317
|
+
}
|
|
318
|
+
function unbox(value, unboxer) {
|
|
319
|
+
try {
|
|
320
|
+
return { matched: true, value: unboxer(value) };
|
|
321
|
+
} catch {
|
|
322
|
+
return { matched: false };
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
function rawJsonUtf8Length(value) {
|
|
326
|
+
let bytes = 0;
|
|
327
|
+
for (let index = 0;index < value.length; index += 1) {
|
|
328
|
+
const code = value.charCodeAt(index);
|
|
329
|
+
if (code <= 127) {
|
|
330
|
+
bytes += 1;
|
|
331
|
+
} else if (code <= 2047) {
|
|
332
|
+
bytes += 2;
|
|
333
|
+
} else if (code >= 55296 && code <= 56319) {
|
|
334
|
+
const next = value.charCodeAt(index + 1);
|
|
335
|
+
if (next >= 56320 && next <= 57343) {
|
|
336
|
+
bytes += 4;
|
|
337
|
+
index += 1;
|
|
338
|
+
} else {
|
|
339
|
+
bytes += 3;
|
|
340
|
+
}
|
|
341
|
+
} else {
|
|
342
|
+
bytes += 3;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
return bytes;
|
|
346
|
+
}
|
|
347
|
+
function jsonStringUtf8Length(value) {
|
|
348
|
+
let bytes = 2;
|
|
349
|
+
for (let index = 0;index < value.length; index += 1) {
|
|
350
|
+
const code = value.charCodeAt(index);
|
|
351
|
+
if (code === 34 || code === 92) {
|
|
352
|
+
bytes += 2;
|
|
353
|
+
} else if (code <= 31) {
|
|
354
|
+
bytes += code === 8 || code === 9 || code === 10 || code === 12 || code === 13 ? 2 : 6;
|
|
355
|
+
} else if (code <= 127) {
|
|
356
|
+
bytes += 1;
|
|
357
|
+
} else if (code <= 2047) {
|
|
358
|
+
bytes += 2;
|
|
359
|
+
} else if (code >= 55296 && code <= 56319) {
|
|
360
|
+
const next = value.charCodeAt(index + 1);
|
|
361
|
+
if (next >= 56320 && next <= 57343) {
|
|
362
|
+
bytes += 4;
|
|
363
|
+
index += 1;
|
|
364
|
+
} else {
|
|
365
|
+
bytes += 6;
|
|
366
|
+
}
|
|
367
|
+
} else if (code >= 56320 && code <= 57343) {
|
|
368
|
+
bytes += 6;
|
|
369
|
+
} else {
|
|
370
|
+
bytes += 3;
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
return bytes;
|
|
374
|
+
}
|
|
375
|
+
function isObject(value) {
|
|
376
|
+
return typeof value === "object" && value !== null;
|
|
377
|
+
}
|
|
378
|
+
function positiveSafeInteger(value, name) {
|
|
379
|
+
if (typeof value !== "number" || !Number.isSafeInteger(value) || value <= 0) {
|
|
380
|
+
throw new Error(`[Sixb] ${name} must be a positive safe integer.`);
|
|
381
|
+
}
|
|
382
|
+
return value;
|
|
103
383
|
}
|
|
104
384
|
|
|
105
385
|
// src/execution/types.ts
|
|
@@ -124,24 +404,32 @@ function isRuntimeAuthorizationCapability(value) {
|
|
|
124
404
|
|
|
125
405
|
// src/execution/authorization.ts
|
|
126
406
|
var registeredAuthorizations = new WeakMap;
|
|
407
|
+
var MAX_DELEGATED_ACTION_APPLY_TARGETS = 4096;
|
|
408
|
+
var MAX_DELEGATED_ACTION_IDENTIFIER_CHARACTERS = 1e6;
|
|
127
409
|
function createPrincipalRuntimeAuthorization(input) {
|
|
410
|
+
if (input.execution.executor.type !== "request") {
|
|
411
|
+
throw new Error("[Sixb] Principal runtime authorization requires a request execution.");
|
|
412
|
+
}
|
|
128
413
|
return createRegisteredPrincipalAuthorization(input);
|
|
129
414
|
}
|
|
130
415
|
function createAgentRuntimeAuthorization(input) {
|
|
131
|
-
if (input.
|
|
132
|
-
throw new Error("[Sixb] Agent
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
416
|
+
if (input.execution.executor.type !== "agent") {
|
|
417
|
+
throw new Error("[Sixb] Agent runtime authorization requires an Agent execution.");
|
|
418
|
+
}
|
|
419
|
+
if (input.authority.type === "principal") {
|
|
420
|
+
return createRegisteredPrincipalAuthorization({
|
|
421
|
+
execution: input.execution,
|
|
422
|
+
context: input.authority.context,
|
|
423
|
+
...input.authority.credential === undefined ? {} : { credential: input.authority.credential }
|
|
424
|
+
});
|
|
425
|
+
}
|
|
426
|
+
return register(input.execution, {
|
|
427
|
+
type: "unrestricted",
|
|
428
|
+
projectId: input.execution.projectId,
|
|
429
|
+
ref: Object.freeze({ type: "disabled" })
|
|
142
430
|
});
|
|
143
431
|
}
|
|
144
|
-
function createRegisteredPrincipalAuthorization(input
|
|
432
|
+
function createRegisteredPrincipalAuthorization(input) {
|
|
145
433
|
const context = snapshotAuthorizationContext(input.context);
|
|
146
434
|
const credential = input.credential ? snapshotCredential(input.credential) : undefined;
|
|
147
435
|
assertCredentialMatchesContext(context, credential);
|
|
@@ -150,22 +438,46 @@ function createRegisteredPrincipalAuthorization(input, executionBinding) {
|
|
|
150
438
|
principal: context.principal,
|
|
151
439
|
...credential === undefined ? {} : { credential }
|
|
152
440
|
});
|
|
153
|
-
return register({
|
|
441
|
+
return register(input.execution, {
|
|
154
442
|
type: "principal",
|
|
155
|
-
projectId: input.projectId,
|
|
443
|
+
projectId: input.execution.projectId,
|
|
156
444
|
context,
|
|
157
|
-
ref
|
|
158
|
-
|
|
445
|
+
ref
|
|
446
|
+
});
|
|
447
|
+
}
|
|
448
|
+
function createDisabledRuntimeAuthorization(execution) {
|
|
449
|
+
return register(execution, {
|
|
450
|
+
type: "unrestricted",
|
|
451
|
+
projectId: execution.projectId,
|
|
452
|
+
ref: Object.freeze({ type: "disabled" })
|
|
159
453
|
});
|
|
160
454
|
}
|
|
161
|
-
function
|
|
162
|
-
|
|
455
|
+
function createDelegatedRuntimeAuthorization(input) {
|
|
456
|
+
const execution = input.execution;
|
|
457
|
+
const objectReadInput = input.objectRead;
|
|
458
|
+
const actionApplyInput = input.actionApply;
|
|
459
|
+
const delegationInput = input.delegation;
|
|
460
|
+
const delegation = delegationInput === undefined ? undefined : snapshotSharedDelegation(delegationInput);
|
|
461
|
+
if (execution.executor.type !== "request" || execution.requestedBy !== undefined) {
|
|
462
|
+
throw new Error("[Sixb] Delegated runtime authorization requires a request execution without a principal.");
|
|
463
|
+
}
|
|
464
|
+
const objectRead = Object.freeze({
|
|
465
|
+
scope: compileSelectedObjectReadScope(objectReadInput.selection),
|
|
466
|
+
limits: snapshotObjectReadExecutionLimits(objectReadInput.limits)
|
|
467
|
+
});
|
|
468
|
+
return register(execution, {
|
|
469
|
+
type: "delegated",
|
|
470
|
+
projectId: execution.projectId,
|
|
471
|
+
objectRead,
|
|
472
|
+
actionApply: snapshotDelegatedActionApply(actionApplyInput ?? []),
|
|
473
|
+
...delegation === undefined ? {} : { delegation }
|
|
474
|
+
});
|
|
163
475
|
}
|
|
164
476
|
function createTrustedPrimitiveRuntimeAuthorization(input) {
|
|
165
477
|
const primitive = snapshotTrustedPrimitive(input.primitive);
|
|
166
|
-
return register({
|
|
478
|
+
return register(input.execution, {
|
|
167
479
|
type: "unrestricted",
|
|
168
|
-
projectId: input.projectId,
|
|
480
|
+
projectId: input.execution.projectId,
|
|
169
481
|
ref: Object.freeze({ type: "trustedPrimitive", primitive })
|
|
170
482
|
});
|
|
171
483
|
}
|
|
@@ -173,15 +485,38 @@ function resolveRuntimeAuthorization(authorization) {
|
|
|
173
485
|
if (!isRuntimeAuthorizationCapability(authorization)) {
|
|
174
486
|
return { type: "denied" };
|
|
175
487
|
}
|
|
176
|
-
return registeredAuthorizations.get(authorization) ?? { type: "denied" };
|
|
488
|
+
return registeredAuthorizations.get(authorization)?.resolved ?? { type: "denied" };
|
|
489
|
+
}
|
|
490
|
+
function resolveRuntimeAuthorizationForProject(input) {
|
|
491
|
+
const resolved = resolveRuntimeAuthorization(input.runtimeAuthorization);
|
|
492
|
+
if (resolved.type === "denied" || typeof input.projectId !== "string" || resolved.projectId !== input.projectId) {
|
|
493
|
+
return { type: "denied" };
|
|
494
|
+
}
|
|
495
|
+
return resolved;
|
|
177
496
|
}
|
|
178
497
|
function getAuthorizationRef(authorization) {
|
|
179
498
|
const resolved = resolveRuntimeAuthorization(authorization);
|
|
180
499
|
if (resolved.type === "denied") {
|
|
181
500
|
throw new Error("[Sixb] Runtime authorization is not a registered Core capability.");
|
|
182
501
|
}
|
|
502
|
+
if (resolved.type === "delegated") {
|
|
503
|
+
if (resolved.delegation) {
|
|
504
|
+
return { type: "delegated", delegation: { ...resolved.delegation } };
|
|
505
|
+
}
|
|
506
|
+
throw new Error("[Sixb] Delegated runtime authorization cannot cross a durable execution boundary.");
|
|
507
|
+
}
|
|
183
508
|
return cloneAuthorizationRef(resolved.ref);
|
|
184
509
|
}
|
|
510
|
+
function snapshotSharedDelegation(input) {
|
|
511
|
+
const kind = input.kind;
|
|
512
|
+
const grantId = input.grantId;
|
|
513
|
+
const sessionId = input.sessionId;
|
|
514
|
+
if (kind !== "share")
|
|
515
|
+
throw new Error("[Sixb] Unknown delegated authority provenance.");
|
|
516
|
+
assertNonEmpty(grantId, "Share grant id");
|
|
517
|
+
assertNonEmpty(sessionId, "Share session id");
|
|
518
|
+
return Object.freeze({ kind, grantId, sessionId });
|
|
519
|
+
}
|
|
185
520
|
function assertExecutionScopeProject(projectId, scope) {
|
|
186
521
|
assertNonEmpty(projectId, "Project id");
|
|
187
522
|
if (scope.execution.projectId !== projectId) {
|
|
@@ -207,42 +542,71 @@ function assertExecutionScopeProject(projectId, scope) {
|
|
|
207
542
|
});
|
|
208
543
|
}
|
|
209
544
|
}
|
|
545
|
+
function captureExecutionScope(scope) {
|
|
546
|
+
const execution = scope.execution;
|
|
547
|
+
const authorization = scope.authorization;
|
|
548
|
+
return Object.freeze({ execution, authorization });
|
|
549
|
+
}
|
|
210
550
|
function resolveExecutionScopeAuthorization(projectId, scope) {
|
|
211
|
-
|
|
212
|
-
|
|
551
|
+
const capturedScope = captureExecutionScope(scope);
|
|
552
|
+
assertExecutionScopeProject(projectId, capturedScope);
|
|
553
|
+
const resolved = resolveRuntimeAuthorization(capturedScope.authorization);
|
|
213
554
|
if (resolved.type === "denied") {
|
|
214
|
-
throw createSixbError("internal.unexpected", "[Sixb] Execution scope carries unregistered runtime authorization.", { details: { executionId:
|
|
555
|
+
throw createSixbError("internal.unexpected", "[Sixb] Execution scope carries unregistered runtime authorization.", { details: { executionId: capturedScope.execution.id, projectId } });
|
|
215
556
|
}
|
|
216
|
-
const
|
|
557
|
+
const registration = registeredAuthorizations.get(capturedScope.authorization);
|
|
558
|
+
if (!registration || !executionMatchesBinding(registration.execution, capturedScope.execution)) {
|
|
559
|
+
throw invalidExecutionAuthority(capturedScope.execution.id, "authority is bound to different execution provenance");
|
|
560
|
+
}
|
|
561
|
+
assertResolvedAuthorizationMatchesExecution(resolved, capturedScope.execution);
|
|
562
|
+
return resolved;
|
|
563
|
+
}
|
|
564
|
+
function assertResolvedAuthorizationMatchesExecution(resolved, execution) {
|
|
217
565
|
switch (execution.executor.type) {
|
|
218
566
|
case "request":
|
|
219
567
|
if (execution.source.type !== "http" || execution.source.requestId !== execution.executor.requestId) {
|
|
220
568
|
throw invalidExecutionAuthority(execution.id, "request source does not match its executor");
|
|
221
569
|
}
|
|
222
|
-
if (resolved.
|
|
223
|
-
if (
|
|
570
|
+
if (resolved.type === "principal") {
|
|
571
|
+
if (!principalsEqual(execution.requestedBy, resolved.ref.principal)) {
|
|
224
572
|
throw invalidExecutionAuthority(execution.id, "request authority does not match its requested-by principal");
|
|
225
573
|
}
|
|
226
|
-
return
|
|
574
|
+
return;
|
|
575
|
+
}
|
|
576
|
+
if (resolved.type === "unrestricted" && resolved.ref.type === "disabled" && execution.requestedBy === undefined) {
|
|
577
|
+
return;
|
|
227
578
|
}
|
|
228
|
-
if (resolved.
|
|
229
|
-
return
|
|
230
|
-
throw invalidExecutionAuthority(execution.id, "request execution requires principal or explicitly disabled authority");
|
|
579
|
+
if (resolved.type === "delegated" && execution.requestedBy === undefined)
|
|
580
|
+
return;
|
|
581
|
+
throw invalidExecutionAuthority(execution.id, "request execution requires principal, delegated, or explicitly disabled authority");
|
|
231
582
|
case "primitive":
|
|
232
|
-
if (resolved.ref.type !== "trustedPrimitive" || resolved.ref.primitive.kind !== execution.executor.kind || resolved.ref.primitive.id !== execution.executor.id || resolved.ref.primitive.runId !== execution.executor.runId) {
|
|
583
|
+
if (resolved.type !== "unrestricted" || resolved.ref.type !== "trustedPrimitive" || resolved.ref.primitive.kind !== execution.executor.kind || resolved.ref.primitive.id !== execution.executor.id || resolved.ref.primitive.runId !== execution.executor.runId) {
|
|
233
584
|
throw invalidExecutionAuthority(execution.id, "trusted primitive authority does not match its executor");
|
|
234
585
|
}
|
|
235
|
-
return
|
|
586
|
+
return;
|
|
236
587
|
case "agent":
|
|
237
|
-
if (
|
|
238
|
-
throw invalidExecutionAuthority(execution.id, "agent
|
|
588
|
+
if (execution.source.type !== "execution") {
|
|
589
|
+
throw invalidExecutionAuthority(execution.id, "agent execution requires an execution source");
|
|
590
|
+
}
|
|
591
|
+
if (resolved.type === "principal" && resolved.ref.type === "principal") {
|
|
592
|
+
if (resolved.ref.principal.type === "serviceAccount") {
|
|
593
|
+
const actorId = execution.executor.actorId;
|
|
594
|
+
if (actorId === undefined || resolved.ref.principal.id !== agentServiceAccountId(actorId) || resolved.ref.credential !== undefined) {
|
|
595
|
+
throw invalidExecutionAuthority(execution.id, "agent authority must reference its managed service account");
|
|
596
|
+
}
|
|
597
|
+
} else if (resolved.ref.credential === undefined) {
|
|
598
|
+
throw invalidExecutionAuthority(execution.id, "inherited user agent authority requires a credential");
|
|
599
|
+
}
|
|
600
|
+
return;
|
|
239
601
|
}
|
|
240
|
-
|
|
602
|
+
if (resolved.type === "unrestricted" && resolved.ref.type === "disabled")
|
|
603
|
+
return;
|
|
604
|
+
throw invalidExecutionAuthority(execution.id, "agent authority must be principal or explicitly disabled");
|
|
241
605
|
case "kernel":
|
|
242
|
-
if (resolved.ref.type !== "kernel" || execution.requestedBy !== undefined || resolved.ref.operation.type !== execution.executor.operation.type || resolved.ref.operation.recoveryId !== execution.executor.operation.recoveryId) {
|
|
606
|
+
if (resolved.type !== "unrestricted" || resolved.ref.type !== "kernel" || execution.requestedBy !== undefined || resolved.ref.operation.type !== execution.executor.operation.type || resolved.ref.operation.recoveryId !== execution.executor.operation.recoveryId) {
|
|
243
607
|
throw invalidExecutionAuthority(execution.id, "kernel authority does not match its executor");
|
|
244
608
|
}
|
|
245
|
-
return
|
|
609
|
+
return;
|
|
246
610
|
}
|
|
247
611
|
}
|
|
248
612
|
function principalsEqual(left, right) {
|
|
@@ -251,19 +615,99 @@ function principalsEqual(left, right) {
|
|
|
251
615
|
function invalidExecutionAuthority(executionId, reason) {
|
|
252
616
|
return createSixbError("internal.unexpected", `[Sixb] Execution '${executionId}' is incompatible with its authority: ${reason}.`, { details: { executionId, reason } });
|
|
253
617
|
}
|
|
254
|
-
function register(input) {
|
|
618
|
+
function register(execution, input) {
|
|
255
619
|
assertNonEmpty(input.projectId, "Authorization project id");
|
|
620
|
+
const executionBinding = snapshotExecutionContext(execution);
|
|
621
|
+
if (input.projectId !== executionBinding.projectId) {
|
|
622
|
+
throw new Error(`[Sixb] Runtime authorization belongs to project '${input.projectId}', not execution project '${executionBinding.projectId}'.`);
|
|
623
|
+
}
|
|
624
|
+
assertResolvedAuthorizationMatchesExecution(input, executionBinding);
|
|
256
625
|
const authorization = createRuntimeAuthorizationCapability();
|
|
257
|
-
registeredAuthorizations.set(authorization, Object.freeze(input));
|
|
626
|
+
registeredAuthorizations.set(authorization, Object.freeze({ resolved: Object.freeze(input), execution: executionBinding }));
|
|
258
627
|
return authorization;
|
|
259
628
|
}
|
|
629
|
+
function executionMatchesBinding(binding, execution) {
|
|
630
|
+
try {
|
|
631
|
+
return isDeepStrictEqual(binding, snapshotExecutionContext(execution));
|
|
632
|
+
} catch {
|
|
633
|
+
return false;
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
function snapshotExecutionContext(execution) {
|
|
637
|
+
assertNonEmpty(execution.id, "Execution id");
|
|
638
|
+
assertNonEmpty(execution.projectId, "Execution project id");
|
|
639
|
+
assertNonEmpty(execution.correlationId, "Execution correlation id");
|
|
640
|
+
return Object.freeze({
|
|
641
|
+
id: execution.id,
|
|
642
|
+
projectId: execution.projectId,
|
|
643
|
+
...execution.requestedBy === undefined ? {} : { requestedBy: snapshotAuthorizablePrincipal(execution.requestedBy) },
|
|
644
|
+
executor: snapshotExecutionExecutor(execution.executor),
|
|
645
|
+
source: snapshotExecutionSource(execution.source),
|
|
646
|
+
correlationId: execution.correlationId
|
|
647
|
+
});
|
|
648
|
+
}
|
|
649
|
+
function snapshotExecutionExecutor(executor) {
|
|
650
|
+
switch (executor.type) {
|
|
651
|
+
case "request":
|
|
652
|
+
assertNonEmpty(executor.requestId, "Execution request id");
|
|
653
|
+
return Object.freeze({ type: "request", requestId: executor.requestId });
|
|
654
|
+
case "primitive": {
|
|
655
|
+
const primitive = snapshotTrustedPrimitive(executor);
|
|
656
|
+
return Object.freeze({ type: "primitive", ...primitive });
|
|
657
|
+
}
|
|
658
|
+
case "agent":
|
|
659
|
+
if (executor.actorId !== undefined)
|
|
660
|
+
assertNonEmpty(executor.actorId, "Execution Agent actor id");
|
|
661
|
+
assertNonEmpty(executor.runId, "Execution Agent run id");
|
|
662
|
+
return Object.freeze({
|
|
663
|
+
type: "agent",
|
|
664
|
+
...executor.actorId === undefined ? {} : { actorId: executor.actorId },
|
|
665
|
+
runId: executor.runId
|
|
666
|
+
});
|
|
667
|
+
case "kernel":
|
|
668
|
+
return Object.freeze({
|
|
669
|
+
type: "kernel",
|
|
670
|
+
operation: snapshotKernelOperation(executor.operation)
|
|
671
|
+
});
|
|
672
|
+
}
|
|
673
|
+
throw new Error(`[Sixb] Unknown execution executor type '${String(executor.type)}'.`);
|
|
674
|
+
}
|
|
675
|
+
function snapshotExecutionSource(source) {
|
|
676
|
+
switch (source.type) {
|
|
677
|
+
case "http":
|
|
678
|
+
assertNonEmpty(source.requestId, "Execution source request id");
|
|
679
|
+
return Object.freeze({ type: "http", requestId: source.requestId });
|
|
680
|
+
case "webhook":
|
|
681
|
+
assertNonEmpty(source.deliveryId, "Execution source delivery id");
|
|
682
|
+
return Object.freeze({ type: "webhook", deliveryId: source.deliveryId });
|
|
683
|
+
case "schedule":
|
|
684
|
+
case "event":
|
|
685
|
+
assertNonEmpty(source.eventId, "Execution source event id");
|
|
686
|
+
return Object.freeze({ type: source.type, eventId: source.eventId });
|
|
687
|
+
case "datasetVersion":
|
|
688
|
+
assertNonEmpty(source.datasetId, "Execution source dataset id");
|
|
689
|
+
assertNonEmpty(source.versionId, "Execution source dataset version id");
|
|
690
|
+
return Object.freeze({
|
|
691
|
+
type: "datasetVersion",
|
|
692
|
+
datasetId: source.datasetId,
|
|
693
|
+
versionId: source.versionId
|
|
694
|
+
});
|
|
695
|
+
case "execution":
|
|
696
|
+
assertNonEmpty(source.executionId, "Execution source execution id");
|
|
697
|
+
return Object.freeze({ type: "execution", executionId: source.executionId });
|
|
698
|
+
}
|
|
699
|
+
throw new Error(`[Sixb] Unknown execution source type '${String(source.type)}'.`);
|
|
700
|
+
}
|
|
260
701
|
function snapshotAuthorizationContext(context) {
|
|
261
702
|
const principal = snapshotAuthorizablePrincipal(context.principal);
|
|
262
|
-
const grants =
|
|
263
|
-
for (const kind of
|
|
264
|
-
grants[kind] = new
|
|
703
|
+
const grants = {};
|
|
704
|
+
for (const kind of TARGETED_GRANT_KIND_KEYS) {
|
|
705
|
+
grants[kind] = new ImmutableGrantSet(context.grants[kind]);
|
|
265
706
|
}
|
|
266
|
-
const frozenGrants = Object.freeze(
|
|
707
|
+
const frozenGrants = Object.freeze({
|
|
708
|
+
...grants,
|
|
709
|
+
"run:agent": context.grants["run:agent"]
|
|
710
|
+
});
|
|
267
711
|
return Object.freeze({
|
|
268
712
|
principal,
|
|
269
713
|
...context.sessionId === undefined ? {} : { sessionId: context.sessionId },
|
|
@@ -272,6 +716,51 @@ function snapshotAuthorizationContext(context) {
|
|
|
272
716
|
grants: frozenGrants
|
|
273
717
|
});
|
|
274
718
|
}
|
|
719
|
+
|
|
720
|
+
class ImmutableGrantSet {
|
|
721
|
+
#values;
|
|
722
|
+
[Symbol.toStringTag] = "Set";
|
|
723
|
+
constructor(values) {
|
|
724
|
+
this.#values = new Set(values);
|
|
725
|
+
Object.freeze(this);
|
|
726
|
+
}
|
|
727
|
+
get size() {
|
|
728
|
+
return this.#values.size;
|
|
729
|
+
}
|
|
730
|
+
has(value) {
|
|
731
|
+
return this.#values.has(value);
|
|
732
|
+
}
|
|
733
|
+
entries() {
|
|
734
|
+
return this.#values.entries();
|
|
735
|
+
}
|
|
736
|
+
keys() {
|
|
737
|
+
return this.#values.keys();
|
|
738
|
+
}
|
|
739
|
+
values() {
|
|
740
|
+
return this.#values.values();
|
|
741
|
+
}
|
|
742
|
+
[Symbol.iterator]() {
|
|
743
|
+
return this.#values[Symbol.iterator]();
|
|
744
|
+
}
|
|
745
|
+
forEach(callback, thisArg) {
|
|
746
|
+
for (const value of this.#values) {
|
|
747
|
+
callback.call(thisArg, value, value, this);
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
add(_value) {
|
|
751
|
+
throw immutableGrantSetMutation();
|
|
752
|
+
}
|
|
753
|
+
delete(_value) {
|
|
754
|
+
throw immutableGrantSetMutation();
|
|
755
|
+
}
|
|
756
|
+
clear() {
|
|
757
|
+
throw immutableGrantSetMutation();
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
Object.freeze(ImmutableGrantSet.prototype);
|
|
761
|
+
function immutableGrantSetMutation() {
|
|
762
|
+
return new Error("[Sixb] Runtime authorization grants are immutable.");
|
|
763
|
+
}
|
|
275
764
|
function snapshotAuthorizablePrincipal(principal) {
|
|
276
765
|
if (principal.type !== "user" && principal.type !== "serviceAccount") {
|
|
277
766
|
throw new Error(`[Sixb] Principal type '${principal.type}' cannot hold runtime authorization.`);
|
|
@@ -306,6 +795,56 @@ function snapshotTrustedPrimitive(primitive) {
|
|
|
306
795
|
assertNonEmpty(primitive.runId, "Trusted primitive run id");
|
|
307
796
|
return Object.freeze({ kind: primitive.kind, id: primitive.id, runId: primitive.runId });
|
|
308
797
|
}
|
|
798
|
+
function snapshotKernelOperation(operation) {
|
|
799
|
+
if (operation.type !== "ontology.recover") {
|
|
800
|
+
throw new Error(`[Sixb] Unknown kernel operation '${operation.type}'.`);
|
|
801
|
+
}
|
|
802
|
+
assertNonEmpty(operation.recoveryId, "Kernel recovery id");
|
|
803
|
+
return Object.freeze({ type: operation.type, recoveryId: operation.recoveryId });
|
|
804
|
+
}
|
|
805
|
+
function snapshotDelegatedActionApply(input) {
|
|
806
|
+
if (!Array.isArray(input)) {
|
|
807
|
+
throw new Error("[Sixb] Delegated Action targets must be an array.");
|
|
808
|
+
}
|
|
809
|
+
const targetCount = input.length;
|
|
810
|
+
if (targetCount > MAX_DELEGATED_ACTION_APPLY_TARGETS) {
|
|
811
|
+
throw new Error(`[Sixb] Delegated authority exceeds the maximum of ${MAX_DELEGATED_ACTION_APPLY_TARGETS} Action targets.`);
|
|
812
|
+
}
|
|
813
|
+
let identifierCharacters = 0;
|
|
814
|
+
const targets = [];
|
|
815
|
+
for (let index = 0;index < targetCount; index += 1) {
|
|
816
|
+
const authoredTarget = input[index];
|
|
817
|
+
if (!isRecord(authoredTarget)) {
|
|
818
|
+
throw new Error(`[Sixb] Delegated Action target ${index} must be an object.`);
|
|
819
|
+
}
|
|
820
|
+
const authoredActionId = authoredTarget.actionId;
|
|
821
|
+
const authoredSubject = authoredTarget.subject;
|
|
822
|
+
if (!isRecord(authoredSubject)) {
|
|
823
|
+
throw new Error(`[Sixb] Delegated Action target ${index} subject must be an ObjectRef.`);
|
|
824
|
+
}
|
|
825
|
+
const actionId = delegatedActionIdentifier(authoredActionId, `Delegated Action target ${index} action id`);
|
|
826
|
+
const objectTypeId = delegatedActionIdentifier(authoredSubject.objectTypeId, `Delegated Action target ${index} subject object type id`);
|
|
827
|
+
const primaryId = delegatedActionIdentifier(authoredSubject.primaryId, `Delegated Action target ${index} subject primary id`);
|
|
828
|
+
identifierCharacters += actionId.length + objectTypeId.length + primaryId.length;
|
|
829
|
+
if (identifierCharacters > MAX_DELEGATED_ACTION_IDENTIFIER_CHARACTERS) {
|
|
830
|
+
throw new Error(`[Sixb] Delegated authority exceeds the maximum of ${MAX_DELEGATED_ACTION_IDENTIFIER_CHARACTERS} Action identifier characters.`);
|
|
831
|
+
}
|
|
832
|
+
targets.push(Object.freeze({
|
|
833
|
+
actionId,
|
|
834
|
+
subject: Object.freeze({ objectTypeId, primaryId })
|
|
835
|
+
}));
|
|
836
|
+
}
|
|
837
|
+
return Object.freeze(targets);
|
|
838
|
+
}
|
|
839
|
+
function delegatedActionIdentifier(value, label) {
|
|
840
|
+
if (typeof value !== "string" || !value.trim()) {
|
|
841
|
+
throw new Error(`[Sixb] ${label} must not be empty.`);
|
|
842
|
+
}
|
|
843
|
+
return value;
|
|
844
|
+
}
|
|
845
|
+
function isRecord(value) {
|
|
846
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
847
|
+
}
|
|
309
848
|
function cloneAuthorizationRef(ref) {
|
|
310
849
|
switch (ref.type) {
|
|
311
850
|
case "principal":
|
|
@@ -316,6 +855,8 @@ function cloneAuthorizationRef(ref) {
|
|
|
316
855
|
};
|
|
317
856
|
case "trustedPrimitive":
|
|
318
857
|
return { type: "trustedPrimitive", primitive: { ...ref.primitive } };
|
|
858
|
+
case "delegated":
|
|
859
|
+
return { type: "delegated", delegation: { ...ref.delegation } };
|
|
319
860
|
case "kernel":
|
|
320
861
|
return { type: "kernel", operation: { ...ref.operation } };
|
|
321
862
|
case "disabled":
|
|
@@ -356,6 +897,8 @@ function atomsFor(request) {
|
|
|
356
897
|
return [{ kind: "append:telemetry", id: request.objectTypeId }];
|
|
357
898
|
case "action.apply":
|
|
358
899
|
return [{ kind: "apply:action", id: request.actionId }];
|
|
900
|
+
case "share.manage":
|
|
901
|
+
return [{ kind: "share:share", id: request.shareId }];
|
|
359
902
|
case "workflow.run":
|
|
360
903
|
return [{ kind: "run:workflow", id: request.workflowId }];
|
|
361
904
|
case "sync.run":
|
|
@@ -363,9 +906,13 @@ function atomsFor(request) {
|
|
|
363
906
|
case "pipeline.run":
|
|
364
907
|
return [{ kind: "run:pipeline", id: request.pipelineId }];
|
|
365
908
|
case "agent.run":
|
|
366
|
-
return [{ kind: "run:agent"
|
|
909
|
+
return [{ kind: "run:agent" }];
|
|
367
910
|
case "logs.observe":
|
|
368
911
|
return [{ kind: "observe:logs", id: "logs" }];
|
|
912
|
+
case "aiUsage.observe":
|
|
913
|
+
return [{ kind: "observe:aiUsage", id: "aiUsage" }];
|
|
914
|
+
case "aiUsage.manage":
|
|
915
|
+
return [{ kind: "manage:aiUsage", id: "aiUsage" }];
|
|
369
916
|
case "connector.manage":
|
|
370
917
|
return [{ kind: "manage:connector", id: request.connectorId }];
|
|
371
918
|
case "object.query":
|
|
@@ -373,11 +920,16 @@ function atomsFor(request) {
|
|
|
373
920
|
}
|
|
374
921
|
}
|
|
375
922
|
function atomKey(atom) {
|
|
376
|
-
if (atom.kind === "
|
|
923
|
+
if (atom.kind === "run:agent")
|
|
924
|
+
return atom.kind;
|
|
925
|
+
if (atom.kind === "observe:logs" || atom.kind === "observe:aiUsage" || atom.kind === "manage:aiUsage") {
|
|
377
926
|
return atom.kind;
|
|
927
|
+
}
|
|
378
928
|
return `${atom.kind}:${atom.id}`;
|
|
379
929
|
}
|
|
380
930
|
function holds(grants, atom) {
|
|
931
|
+
if (atom.kind === "run:agent")
|
|
932
|
+
return grants[atom.kind];
|
|
381
933
|
return grants[atom.kind].has(atom.id);
|
|
382
934
|
}
|
|
383
935
|
function evaluate(authorization, request) {
|
|
@@ -391,6 +943,9 @@ function isAllowed(authorization, request) {
|
|
|
391
943
|
}
|
|
392
944
|
function assertAuthorized(runtime, request) {
|
|
393
945
|
const resolved = assertRuntimeAuthorizationBound(runtime);
|
|
946
|
+
if (resolved.type === "delegated") {
|
|
947
|
+
throw new AuthorizationError(`delegated:${request.kind}`, `[Sixb] Operation '${request.kind}' is not covered by delegated authorization.`);
|
|
948
|
+
}
|
|
394
949
|
const authorization = resolved.type === "principal" ? resolved.context : undefined;
|
|
395
950
|
const decision = evaluate(authorization, request);
|
|
396
951
|
if (decision.allowed) {
|
|
@@ -398,8 +953,14 @@ function assertAuthorized(runtime, request) {
|
|
|
398
953
|
}
|
|
399
954
|
throw new AuthorizationError(decision.missing[0] ?? request.kind, deniedMessage(authorization, request));
|
|
400
955
|
}
|
|
956
|
+
function isRuntimeAllowed(runtime, request) {
|
|
957
|
+
const authority = resolveRuntimeAuthorizationForProject(runtime);
|
|
958
|
+
if (authority.type === "denied" || authority.type === "delegated")
|
|
959
|
+
return false;
|
|
960
|
+
return authority.type === "unrestricted" || isAllowed(authority.context, request);
|
|
961
|
+
}
|
|
401
962
|
function assertRuntimeAuthorizationBound(runtime) {
|
|
402
|
-
const resolved =
|
|
963
|
+
const resolved = resolveRuntimeAuthorizationForProject(runtime);
|
|
403
964
|
if (resolved.type === "denied") {
|
|
404
965
|
throw new AuthorizationError("runtime:unbound", "[Sixb] Protected operations require a registered execution scope.");
|
|
405
966
|
}
|
|
@@ -423,13 +984,14 @@ function assertPrivileged(runtime, operation) {
|
|
|
423
984
|
throw new AuthorizationError(`privileged:${operation}`, `[Sixb] Operation '${operation}' is not covered by scoped authorization grants.`);
|
|
424
985
|
}
|
|
425
986
|
function assertProviderAccess(runtime, execution, operation) {
|
|
426
|
-
const resolved =
|
|
987
|
+
const resolved = resolveExecutionScopeAuthorization(runtime.projectId, {
|
|
988
|
+
execution,
|
|
989
|
+
authorization: runtime.runtimeAuthorization
|
|
990
|
+
});
|
|
427
991
|
if (resolved.type === "unrestricted") {
|
|
428
992
|
return;
|
|
429
993
|
}
|
|
430
|
-
|
|
431
|
-
const executor = execution.executor;
|
|
432
|
-
if (binding?.type === "agent" && executor.type === "agent" && binding.executionId === execution.id && binding.agentId === executor.agentId && binding.runId === executor.runId) {
|
|
994
|
+
if (execution.executor.type === "agent") {
|
|
433
995
|
return;
|
|
434
996
|
}
|
|
435
997
|
throw new AuthorizationError(`privileged:${operation}`, `[Sixb] Operation '${operation}' is not covered by scoped authorization grants.`);
|
|
@@ -449,6 +1011,8 @@ function deniedMessage(authorization, request) {
|
|
|
449
1011
|
return `[Sixb] Principal '${principalId}' is not allowed to append telemetry for object type '${request.objectTypeId}'.`;
|
|
450
1012
|
case "action.apply":
|
|
451
1013
|
return `[Sixb] Principal '${principalId}' is not allowed to apply action '${request.actionId}'.`;
|
|
1014
|
+
case "share.manage":
|
|
1015
|
+
return `[Sixb] Principal '${principalId}' is not allowed to manage Share '${request.shareId}'.`;
|
|
452
1016
|
case "workflow.run":
|
|
453
1017
|
return `[Sixb] Principal '${principalId}' is not allowed to run workflow '${request.workflowId}'.`;
|
|
454
1018
|
case "sync.run":
|
|
@@ -456,9 +1020,13 @@ function deniedMessage(authorization, request) {
|
|
|
456
1020
|
case "pipeline.run":
|
|
457
1021
|
return `[Sixb] Principal '${principalId}' is not allowed to run pipeline '${request.pipelineId}'.`;
|
|
458
1022
|
case "agent.run":
|
|
459
|
-
return `[Sixb] Principal '${principalId}' is not allowed to run
|
|
1023
|
+
return `[Sixb] Principal '${principalId}' is not allowed to run the project Agent.`;
|
|
460
1024
|
case "logs.observe":
|
|
461
1025
|
return `[Sixb] Principal '${principalId}' is not allowed to observe project logs.`;
|
|
1026
|
+
case "aiUsage.observe":
|
|
1027
|
+
return `[Sixb] Principal '${principalId}' is not allowed to observe project AI usage.`;
|
|
1028
|
+
case "aiUsage.manage":
|
|
1029
|
+
return `[Sixb] Principal '${principalId}' is not allowed to manage project AI usage limits.`;
|
|
462
1030
|
case "connector.manage":
|
|
463
1031
|
return `[Sixb] Principal '${principalId}' is not allowed to manage connector '${request.connectorId}'.`;
|
|
464
1032
|
case "object.query": {
|
|
@@ -534,6 +1102,10 @@ function canViewEvent(authorization, event) {
|
|
|
534
1102
|
function resolveRoleGrants(role, universe) {
|
|
535
1103
|
const grants = emptyGrantSets();
|
|
536
1104
|
for (const grant of role.grants) {
|
|
1105
|
+
if (grant.capability === "run" && grant.target === "agent") {
|
|
1106
|
+
grants["run:agent"] = true;
|
|
1107
|
+
continue;
|
|
1108
|
+
}
|
|
537
1109
|
const kind = grantKindOf(grant);
|
|
538
1110
|
const spec = GRANT_KINDS[kind];
|
|
539
1111
|
expandSelection(grant.selection, universe[spec.universeKey], grants[kind], spec.expandsSubtypes ? universe.getSubTypes : undefined);
|
|
@@ -568,7 +1140,10 @@ function resolveAuthorizationContext(input) {
|
|
|
568
1140
|
continue;
|
|
569
1141
|
}
|
|
570
1142
|
roleIds.push(role.id);
|
|
571
|
-
|
|
1143
|
+
if (role.grants["run:agent"]) {
|
|
1144
|
+
grants["run:agent"] = true;
|
|
1145
|
+
}
|
|
1146
|
+
for (const kind of TARGETED_GRANT_KIND_KEYS) {
|
|
572
1147
|
for (const id of role.grants[kind]) {
|
|
573
1148
|
grants[kind].add(id);
|
|
574
1149
|
}
|
|
@@ -968,7 +1543,7 @@ function assertProjectionDataset(dataset) {
|
|
|
968
1543
|
}
|
|
969
1544
|
assertNonEmpty2(dataset.id, "dataset id");
|
|
970
1545
|
}
|
|
971
|
-
function
|
|
1546
|
+
function isRecord2(value) {
|
|
972
1547
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
973
1548
|
}
|
|
974
1549
|
function lowerForeignKeyMapping(mapping) {
|
|
@@ -981,7 +1556,7 @@ function lowerForeignKeyMapping(mapping) {
|
|
|
981
1556
|
return lowered;
|
|
982
1557
|
}
|
|
983
1558
|
function isForeignKeyDescriptor(value) {
|
|
984
|
-
return
|
|
1559
|
+
return isRecord2(value) && typeof value.linkId === "string";
|
|
985
1560
|
}
|
|
986
1561
|
function defineProjection(id, target) {
|
|
987
1562
|
if ("link" in target)
|
|
@@ -1134,7 +1709,7 @@ function lowerTelemetryPropertiesPointMapping(objectType, mapping) {
|
|
|
1134
1709
|
if (mapping.properties === undefined) {
|
|
1135
1710
|
throw new ProjectionValidationError("Telemetry projection point mapping requires properties.");
|
|
1136
1711
|
}
|
|
1137
|
-
if (!
|
|
1712
|
+
if (!isRecord2(mapping.properties)) {
|
|
1138
1713
|
throw new ProjectionValidationError("Telemetry projection point mapping properties must be an object.");
|
|
1139
1714
|
}
|
|
1140
1715
|
assertNonEmpty2(mapping.objectId, "objectId field");
|
|
@@ -1162,7 +1737,7 @@ function lowerTelemetryPropertyMapping(propertyId, input) {
|
|
|
1162
1737
|
assertNonEmpty2(input, `property '${propertyId}' value field`);
|
|
1163
1738
|
return { valueField: input };
|
|
1164
1739
|
}
|
|
1165
|
-
if (!
|
|
1740
|
+
if (!isRecord2(input)) {
|
|
1166
1741
|
throw new ProjectionValidationError(`Telemetry projection property '${propertyId}' must map a value column or value/unit columns.`);
|
|
1167
1742
|
}
|
|
1168
1743
|
const allowedKeys = new Set(["value", "unit"]);
|
|
@@ -1231,33 +1806,33 @@ function buildLinkProjection(id, linkToken) {
|
|
|
1231
1806
|
};
|
|
1232
1807
|
}
|
|
1233
1808
|
function isObjectProjectionDefinition(value) {
|
|
1234
|
-
if (!
|
|
1809
|
+
if (!isRecord2(value))
|
|
1235
1810
|
return false;
|
|
1236
|
-
return value._tag === "ObjectProjectionDefinition" && typeof value.id === "string" && typeof value.objectTypeId === "string" && typeof value.datasetId === "string" &&
|
|
1811
|
+
return value._tag === "ObjectProjectionDefinition" && typeof value.id === "string" && typeof value.objectTypeId === "string" && typeof value.datasetId === "string" && isRecord2(value.properties) && isRecord2(value.links) && isSourceEditConflictResolution(value.conflictResolution);
|
|
1237
1812
|
}
|
|
1238
1813
|
function isSourceEditConflictResolution(value) {
|
|
1239
1814
|
if (value === undefined)
|
|
1240
1815
|
return true;
|
|
1241
|
-
if (!
|
|
1816
|
+
if (!isRecord2(value) || typeof value.strategy !== "string")
|
|
1242
1817
|
return false;
|
|
1243
1818
|
if (value.strategy === "editsWin")
|
|
1244
1819
|
return value.sourceTimestamp === undefined;
|
|
1245
1820
|
return value.strategy === "mostRecent" && typeof value.sourceTimestamp === "string";
|
|
1246
1821
|
}
|
|
1247
1822
|
function isLinkProjectionDefinition(value) {
|
|
1248
|
-
if (!
|
|
1823
|
+
if (!isRecord2(value))
|
|
1249
1824
|
return false;
|
|
1250
1825
|
return value._tag === "LinkProjectionDefinition" && typeof value.id === "string" && typeof value.linkId === "string" && typeof value.sourceObjectTypeId === "string" && typeof value.targetObjectTypeId === "string" && typeof value.datasetId === "string" && typeof value.sourceField === "string" && typeof value.targetField === "string";
|
|
1251
1826
|
}
|
|
1252
1827
|
function isTelemetryProjectionDefinition(value) {
|
|
1253
|
-
if (!
|
|
1828
|
+
if (!isRecord2(value))
|
|
1254
1829
|
return false;
|
|
1255
1830
|
return value._tag === "TelemetryProjectionDefinition" && typeof value.id === "string" && typeof value.objectTypeId === "string" && typeof value.datasetId === "string" && typeof value.objectIdField === "string" && typeof value.atField === "string" && isTelemetryProjectionProperties(value.properties);
|
|
1256
1831
|
}
|
|
1257
1832
|
function isTelemetryProjectionProperties(value) {
|
|
1258
|
-
if (!
|
|
1833
|
+
if (!isRecord2(value) || Object.keys(value).length === 0)
|
|
1259
1834
|
return false;
|
|
1260
|
-
return Object.values(value).every((mapping) =>
|
|
1835
|
+
return Object.values(value).every((mapping) => isRecord2(mapping) && typeof mapping.valueField === "string" && (mapping.unitField === undefined || typeof mapping.unitField === "string"));
|
|
1261
1836
|
}
|
|
1262
1837
|
function isProjectionDefinition(value) {
|
|
1263
1838
|
return isObjectProjectionDefinition(value) || isLinkProjectionDefinition(value) || isTelemetryProjectionDefinition(value);
|
|
@@ -1307,6 +1882,6 @@ function canViewProjection(authorization, projection) {
|
|
|
1307
1882
|
function emptyGrantIndex() {
|
|
1308
1883
|
return emptyGrantSets();
|
|
1309
1884
|
}
|
|
1310
|
-
export { ProjectionValidationError, computeProjectionOwnership, validateProjectionOwnership, validateTelemetryProjectionFieldMapping, validateProjectionsAtStartup, defineProjection, fromForeignKey, isObjectProjectionDefinition, isLinkProjectionDefinition, isTelemetryProjectionDefinition, isProjectionDefinition, projectionTargetOf, GRANT_KINDS, grantKindOf, createPrincipalRuntimeAuthorization, createAgentRuntimeAuthorization, createDisabledRuntimeAuthorization, createTrustedPrimitiveRuntimeAuthorization, getAuthorizationRef, resolveExecutionScopeAuthorization, AuthorizationError, evaluate, isAllowed, assertAuthorized, assertCanEdit, assertCanAppendTelemetry, assertCanManageConnector, assertPrivileged, assertProviderAccess, isApplicationAccessControlled, canAccessApplication, canViewEvent, resolveRoleGrants, resolveAuthorizationContext, canViewActionRun, canViewWorkflowRun, canViewWorkflowIntervention, canViewPipelineRun, canViewProjectionRun, canViewProjection, emptyGrantIndex };
|
|
1885
|
+
export { ProjectionValidationError, computeProjectionOwnership, validateProjectionOwnership, validateTelemetryProjectionFieldMapping, validateProjectionsAtStartup, defineProjection, fromForeignKey, isObjectProjectionDefinition, isLinkProjectionDefinition, isTelemetryProjectionDefinition, isProjectionDefinition, projectionTargetOf, agentServiceAccountId, GRANT_KINDS, grantKindOf, MAX_OBJECT_READ_FACETS, ObjectReadLimitExceededError, snapshotObjectReadExecutionLimits, assertObjectReadFacetCount, assertObjectReadOutputWithinLimit, createPrincipalRuntimeAuthorization, createAgentRuntimeAuthorization, createDisabledRuntimeAuthorization, createDelegatedRuntimeAuthorization, createTrustedPrimitiveRuntimeAuthorization, resolveRuntimeAuthorizationForProject, getAuthorizationRef, captureExecutionScope, resolveExecutionScopeAuthorization, AuthorizationError, evaluate, isAllowed, assertAuthorized, isRuntimeAllowed, assertRuntimeAuthorizationBound, assertCanEdit, assertCanAppendTelemetry, assertCanManageConnector, assertPrivileged, assertProviderAccess, isApplicationAccessControlled, canAccessApplication, canViewEvent, resolveRoleGrants, resolveAuthorizationContext, canViewActionRun, canViewWorkflowRun, canViewWorkflowIntervention, canViewPipelineRun, canViewProjectionRun, canViewProjection, emptyGrantIndex };
|
|
1311
1886
|
|
|
1312
|
-
//# debugId=
|
|
1887
|
+
//# debugId=57388FDEBF4490DF64756E2164756E21
|