@sixb/core 0.1.20 → 0.1.21
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/execution.d.ts.map +1 -1
- package/dist/actions/index.js +54 -47
- package/dist/actions/index.js.map +1 -1
- package/dist/actions/request.d.ts.map +1 -1
- package/dist/actions/run-authorization.d.ts +9 -0
- package/dist/actions/run-authorization.d.ts.map +1 -1
- package/dist/activity/connection.d.ts +62 -0
- package/dist/activity/connection.d.ts.map +1 -0
- package/dist/activity/device.d.ts +8 -0
- package/dist/activity/device.d.ts.map +1 -0
- package/dist/activity/execution.d.ts +48 -0
- package/dist/activity/execution.d.ts.map +1 -0
- package/dist/activity/service.d.ts +79 -0
- package/dist/activity/service.d.ts.map +1 -0
- package/dist/activity/shares.d.ts +24 -0
- package/dist/activity/shares.d.ts.map +1 -0
- package/dist/activity/timeline.d.ts +96 -0
- package/dist/activity/timeline.d.ts.map +1 -0
- package/dist/agents/index.d.ts +2 -1
- package/dist/agents/index.d.ts.map +1 -1
- package/dist/agents/index.js +63 -50
- package/dist/agents/index.js.map +1 -1
- package/dist/agents/request.d.ts.map +1 -1
- package/dist/agents/skills.d.ts.map +1 -1
- package/dist/agents/streams/index.js +3 -3
- package/dist/agents/streams/internal.js +3 -3
- package/dist/agents/types.d.ts +8 -8
- package/dist/agents/types.d.ts.map +1 -1
- package/dist/agents/validation.d.ts +1 -1
- package/dist/agents/validation.d.ts.map +1 -1
- package/dist/artifacts/address.d.ts +48 -0
- package/dist/artifacts/address.d.ts.map +1 -0
- package/dist/artifacts/csv.d.ts +22 -0
- package/dist/artifacts/csv.d.ts.map +1 -0
- package/dist/artifacts/errors.d.ts +11 -0
- package/dist/artifacts/errors.d.ts.map +1 -0
- package/dist/artifacts/execution.d.ts +43 -0
- package/dist/artifacts/execution.d.ts.map +1 -0
- package/dist/artifacts/frames/assets.d.ts +28 -0
- package/dist/artifacts/frames/assets.d.ts.map +1 -0
- package/dist/artifacts/frames/grants.d.ts +37 -0
- package/dist/artifacts/frames/grants.d.ts.map +1 -0
- package/dist/artifacts/frames/index.d.ts +10 -0
- package/dist/artifacts/frames/index.d.ts.map +1 -0
- package/dist/artifacts/frames/index.js +892 -0
- package/dist/artifacts/frames/index.js.map +14 -0
- package/dist/artifacts/frames/kit.d.ts +66 -0
- package/dist/artifacts/frames/kit.d.ts.map +1 -0
- package/dist/artifacts/frames/probe.d.ts +41 -0
- package/dist/artifacts/frames/probe.d.ts.map +1 -0
- package/dist/artifacts/frames/protocol.d.ts +98 -0
- package/dist/artifacts/frames/protocol.d.ts.map +1 -0
- package/dist/artifacts/frames/runtime.d.ts +13 -0
- package/dist/artifacts/frames/runtime.d.ts.map +1 -0
- package/dist/artifacts/html.d.ts +6 -0
- package/dist/artifacts/html.d.ts.map +1 -0
- package/dist/artifacts/ids.d.ts +5 -0
- package/dist/artifacts/ids.d.ts.map +1 -0
- package/dist/artifacts/index.d.ts +16 -0
- package/dist/artifacts/index.d.ts.map +1 -0
- package/dist/artifacts/index.js +125 -0
- package/dist/artifacts/index.js.map +10 -0
- package/dist/artifacts/kinds.d.ts +5 -0
- package/dist/artifacts/kinds.d.ts.map +1 -0
- package/dist/artifacts/limits.d.ts +28 -0
- package/dist/artifacts/limits.d.ts.map +1 -0
- package/dist/artifacts/outline.d.ts +44 -0
- package/dist/artifacts/outline.d.ts.map +1 -0
- package/dist/artifacts/publish/files.d.ts +15 -0
- package/dist/artifacts/publish/files.d.ts.map +1 -0
- package/dist/artifacts/publish/index.d.ts +5 -0
- package/dist/artifacts/publish/index.d.ts.map +1 -0
- package/dist/artifacts/publish/index.js +36 -0
- package/dist/artifacts/publish/index.js.map +9 -0
- package/dist/artifacts/publish/publish.d.ts +52 -0
- package/dist/artifacts/publish/publish.d.ts.map +1 -0
- package/dist/artifacts/publish/references.d.ts +27 -0
- package/dist/artifacts/publish/references.d.ts.map +1 -0
- package/dist/artifacts/publish/validate/document.d.ts +17 -0
- package/dist/artifacts/publish/validate/document.d.ts.map +1 -0
- package/dist/artifacts/publish/validate/file.d.ts +8 -0
- package/dist/artifacts/publish/validate/file.d.ts.map +1 -0
- package/dist/artifacts/publish/validate/sheet.d.ts +15 -0
- package/dist/artifacts/publish/validate/sheet.d.ts.map +1 -0
- package/dist/artifacts/publish/validate/slides.d.ts +21 -0
- package/dist/artifacts/publish/validate/slides.d.ts.map +1 -0
- package/dist/artifacts/references.d.ts +12 -0
- package/dist/artifacts/references.d.ts.map +1 -0
- package/dist/artifacts/resolve.d.ts +41 -0
- package/dist/artifacts/resolve.d.ts.map +1 -0
- package/dist/artifacts/theme.d.ts +19 -0
- package/dist/artifacts/theme.d.ts.map +1 -0
- package/dist/artifacts/warnings.d.ts +11 -0
- package/dist/artifacts/warnings.d.ts.map +1 -0
- package/dist/artifacts/workbook.d.ts +64 -0
- package/dist/artifacts/workbook.d.ts.map +1 -0
- package/dist/auth/index.js +10 -10
- package/dist/authorization/decision.d.ts +2 -0
- package/dist/authorization/decision.d.ts.map +1 -1
- package/dist/authorization/grant-kinds.d.ts +2 -2
- package/dist/authorization/grant-kinds.d.ts.map +1 -1
- package/dist/authorization/index.js +6 -6
- package/dist/blob-storage/browser.js +1 -1
- package/dist/blob-storage/index.js +2 -2
- package/dist/blob-storage/internal.d.ts +1 -1
- package/dist/blob-storage/internal.d.ts.map +1 -1
- package/dist/blob-storage/internal.js +11 -5
- package/dist/blob-storage/internal.js.map +1 -1
- package/dist/blob-storage/media-type.d.ts +12 -0
- package/dist/blob-storage/media-type.d.ts.map +1 -1
- package/dist/bootstrap/index.js +53 -47
- package/dist/bootstrap/index.js.map +2 -2
- package/dist/{chunk-xfs8x8m9.js → chunk-0bphap9y.js} +5 -5
- package/dist/{chunk-1zq2p6g0.js → chunk-1cc1xaf3.js} +3 -3
- package/dist/chunk-3jms7je7.js +14 -0
- package/dist/chunk-3jms7je7.js.map +10 -0
- package/dist/{chunk-s54c868q.js → chunk-3qct2mdc.js} +3 -13
- package/dist/chunk-3qct2mdc.js.map +12 -0
- package/dist/{chunk-t7x8dmn0.js → chunk-431pyp2c.js} +3 -3
- package/dist/{chunk-c85m1hyj.js → chunk-447a5c0p.js} +2 -2
- package/dist/chunk-48qjhh6v.js +185 -0
- package/dist/chunk-48qjhh6v.js.map +13 -0
- package/dist/{chunk-ren4kg2j.js → chunk-561r0yc9.js} +8 -8
- package/dist/{chunk-5e43w60z.js → chunk-5948n82c.js} +2 -2
- package/dist/{chunk-yzwja0mj.js → chunk-5hx48dnn.js} +2 -2
- package/dist/{chunk-x6m907x7.js → chunk-5vems3nx.js} +5 -6
- package/dist/{chunk-x6m907x7.js.map → chunk-5vems3nx.js.map} +3 -3
- package/dist/{chunk-0rbyz4qy.js → chunk-61y5xs4p.js} +560 -164
- package/dist/{chunk-0rbyz4qy.js.map → chunk-61y5xs4p.js.map} +12 -9
- package/dist/chunk-65abf64x.js +13 -0
- package/dist/chunk-65abf64x.js.map +10 -0
- package/dist/{chunk-z3y5kg1x.js → chunk-6eqsgvxk.js} +3 -3
- package/dist/{chunk-z3y5kg1x.js.map → chunk-6eqsgvxk.js.map} +2 -2
- package/dist/chunk-6rqgmkde.js +2028 -0
- package/dist/chunk-6rqgmkde.js.map +29 -0
- package/dist/{chunk-d0bqz29d.js → chunk-6vb4st8k.js} +8 -4
- package/dist/{chunk-d0bqz29d.js.map → chunk-6vb4st8k.js.map} +3 -3
- package/dist/chunk-7q8t23v4.js +467 -0
- package/dist/chunk-7q8t23v4.js.map +14 -0
- package/dist/{chunk-5j58wjct.js → chunk-858emn8m.js} +6 -6
- package/dist/{chunk-hvsb78a1.js → chunk-8frc8a4j.js} +26 -26
- package/dist/{chunk-hvsb78a1.js.map → chunk-8frc8a4j.js.map} +2 -2
- package/dist/{chunk-3zxk45er.js → chunk-8ncg20rd.js} +3 -68
- package/dist/{chunk-3zxk45er.js.map → chunk-8ncg20rd.js.map} +4 -5
- package/dist/{chunk-n33z5bjw.js → chunk-918wwnaa.js} +490 -24
- package/dist/{chunk-n33z5bjw.js.map → chunk-918wwnaa.js.map} +13 -11
- package/dist/{chunk-rrzt8jdy.js → chunk-9j4jw7as.js} +103 -110
- package/dist/chunk-9j4jw7as.js.map +14 -0
- package/dist/chunk-9kgkfg6v.js +502 -0
- package/dist/chunk-9kgkfg6v.js.map +14 -0
- package/dist/chunk-a3faa34j.js +74 -0
- package/dist/chunk-a3faa34j.js.map +10 -0
- package/dist/{chunk-6c6sn0bh.js → chunk-akzryx9h.js} +335 -1167
- package/dist/{chunk-6c6sn0bh.js.map → chunk-akzryx9h.js.map} +18 -24
- package/dist/chunk-arns890k.js +10 -0
- package/dist/chunk-arns890k.js.map +10 -0
- package/dist/{chunk-hjzdd750.js → chunk-bk9svbcq.js} +11 -11
- package/dist/{chunk-hjzdd750.js.map → chunk-bk9svbcq.js.map} +2 -2
- package/dist/{chunk-hkc3jct7.js → chunk-c06hmxyy.js} +2 -10
- package/dist/chunk-c06hmxyy.js.map +10 -0
- package/dist/{chunk-6p49a5cq.js → chunk-c1rxbz5y.js} +3 -3
- package/dist/chunk-cfj9dfbb.js +288 -0
- package/dist/chunk-cfj9dfbb.js.map +12 -0
- package/dist/{chunk-bx9q3cwv.js → chunk-cn0fwwhy.js} +7 -7
- package/dist/{chunk-bx9q3cwv.js.map → chunk-cn0fwwhy.js.map} +1 -1
- package/dist/{chunk-gc4ntf7d.js → chunk-cwdzcv37.js} +1 -1
- package/dist/{chunk-fa02jy15.js → chunk-cy4mbddw.js} +1 -1
- package/dist/{chunk-9w055r5b.js → chunk-d09e3rax.js} +1 -1
- package/dist/chunk-d5rjr8c0.js +176 -0
- package/dist/chunk-d5rjr8c0.js.map +12 -0
- package/dist/{chunk-dk8tkk5f.js → chunk-d7dnxdep.js} +3 -3
- package/dist/{chunk-b38szspf.js → chunk-dhcv7yxc.js} +1 -1
- package/dist/{chunk-b38szspf.js.map → chunk-dhcv7yxc.js.map} +1 -1
- package/dist/{chunk-gsjm1wms.js → chunk-dhdha526.js} +8 -2
- package/dist/chunk-dhdha526.js.map +10 -0
- package/dist/{chunk-8mx7qw3y.js → chunk-dvd2fp9q.js} +2 -2
- package/dist/{chunk-8mx7qw3y.js.map → chunk-dvd2fp9q.js.map} +3 -3
- package/dist/{chunk-way52z4h.js → chunk-e17zdm62.js} +6 -12
- package/dist/{chunk-way52z4h.js.map → chunk-e17zdm62.js.map} +3 -4
- package/dist/{chunk-tpn40322.js → chunk-e6k4thh5.js} +11 -10
- package/dist/{chunk-tpn40322.js.map → chunk-e6k4thh5.js.map} +3 -3
- package/dist/{chunk-tw03bsmb.js → chunk-eptrvnby.js} +224 -3
- package/dist/chunk-eptrvnby.js.map +12 -0
- package/dist/{chunk-es1gxsbf.js → chunk-f4pamkt9.js} +8 -10
- package/dist/chunk-f4pamkt9.js.map +12 -0
- package/dist/chunk-ff5xkv0p.js +211 -0
- package/dist/chunk-ff5xkv0p.js.map +10 -0
- package/dist/{chunk-d09tj99x.js → chunk-g257jwnc.js} +10 -4
- package/dist/{chunk-d09tj99x.js.map → chunk-g257jwnc.js.map} +3 -3
- package/dist/chunk-g5bvzyyr.js +32 -0
- package/dist/chunk-g5bvzyyr.js.map +10 -0
- package/dist/chunk-hke9aeen.js +9 -0
- package/dist/chunk-hke9aeen.js.map +10 -0
- package/dist/{chunk-1sr8ryzk.js → chunk-hwksyjks.js} +122 -1
- package/dist/{chunk-1sr8ryzk.js.map → chunk-hwksyjks.js.map} +3 -3
- package/dist/chunk-jcfw4h7m.js +9 -0
- package/dist/chunk-jcfw4h7m.js.map +10 -0
- package/dist/{chunk-k6q3n2sc.js → chunk-k43ct2ke.js} +20 -11
- package/dist/chunk-k43ct2ke.js.map +12 -0
- package/dist/{chunk-3t2hgbgd.js → chunk-kge7k6ey.js} +40 -8
- package/dist/chunk-kge7k6ey.js.map +15 -0
- package/dist/{chunk-tg2cw67r.js → chunk-ky3j490c.js} +2 -2
- package/dist/chunk-mjddfa7k.js +129 -0
- package/dist/chunk-mjddfa7k.js.map +12 -0
- package/dist/{chunk-vpq4shxz.js → chunk-nn5xnx3s.js} +45 -10
- package/dist/{chunk-vpq4shxz.js.map → chunk-nn5xnx3s.js.map} +7 -6
- package/dist/{chunk-0yh890a4.js → chunk-q5e5tv4b.js} +35 -7
- package/dist/{chunk-0yh890a4.js.map → chunk-q5e5tv4b.js.map} +3 -3
- package/dist/{chunk-vyf9kfqf.js → chunk-q7gn29y3.js} +1 -1
- package/dist/{chunk-yevzdx4y.js → chunk-rmakanzx.js} +10 -12
- package/dist/{chunk-yevzdx4y.js.map → chunk-rmakanzx.js.map} +3 -4
- package/dist/{chunk-v9xd5wzd.js → chunk-s7jg7pmn.js} +1 -1
- package/dist/chunk-tbc1ngpd.js +642 -0
- package/dist/chunk-tbc1ngpd.js.map +18 -0
- package/dist/chunk-twe4dx8p.js +676 -0
- package/dist/chunk-twe4dx8p.js.map +15 -0
- package/dist/{chunk-9dmt152s.js → chunk-vf57cr4t.js} +2 -2
- package/dist/{chunk-9ybhtmg4.js → chunk-vvxtn22d.js} +1 -1
- package/dist/{chunk-jhm3zsa7.js → chunk-wkv3h3q7.js} +64 -2
- package/dist/{chunk-jhm3zsa7.js.map → chunk-wkv3h3q7.js.map} +3 -3
- package/dist/chunk-x0v3jd47.js +124 -0
- package/dist/chunk-x0v3jd47.js.map +10 -0
- package/dist/{chunk-7t429e3f.js → chunk-xvsc5m8n.js} +1 -1
- package/dist/{chunk-z4m0yz8c.js → chunk-y5tah2kf.js} +1 -1
- package/dist/{chunk-fkgc1wt8.js → chunk-z58tm0hm.js} +2 -2
- package/dist/datasets/builders.d.ts +15 -2
- package/dist/datasets/builders.d.ts.map +1 -1
- package/dist/datasets/column-index.d.ts +7 -0
- package/dist/datasets/column-index.d.ts.map +1 -0
- package/dist/datasets/execution.d.ts +3 -2
- package/dist/datasets/execution.d.ts.map +1 -1
- package/dist/datasets/write.js +8 -8
- package/dist/error-reporting/internal.js +4 -4
- package/dist/errors/internal.d.ts +1 -0
- package/dist/errors/internal.d.ts.map +1 -1
- package/dist/errors/internal.js +7 -4
- package/dist/errors/internal.js.map +1 -1
- package/dist/events/execution.d.ts +12 -2
- package/dist/events/execution.d.ts.map +1 -1
- package/dist/events/index.js +4 -4
- package/dist/execution/agent.js +56 -49
- package/dist/execution/agent.js.map +1 -1
- package/dist/execution/authorized-object-reader.d.ts +52 -11
- package/dist/execution/authorized-object-reader.d.ts.map +1 -1
- package/dist/execution/object-reader-clearance.d.ts +41 -0
- package/dist/execution/object-reader-clearance.d.ts.map +1 -0
- package/dist/execution/object-reader-ontology.d.ts +12 -0
- package/dist/execution/object-reader-ontology.d.ts.map +1 -0
- package/dist/execution/object-reader-security.d.ts +45 -0
- package/dist/execution/object-reader-security.d.ts.map +1 -0
- package/dist/execution/primitive.js +54 -47
- package/dist/execution/primitive.js.map +1 -1
- package/dist/execution/request.js +48 -41
- package/dist/execution/request.js.map +2 -2
- package/dist/http/api-routes.d.ts.map +1 -1
- package/dist/http/index.js +1 -1
- package/dist/index.d.ts +20 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +112 -97
- package/dist/index.js.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 -3
- package/dist/lake-storage/index.d.ts.map +1 -1
- package/dist/lake-storage/index.js +21 -13
- package/dist/lake-storage/index.js.map +1 -1
- package/dist/lake-storage/lineage.d.ts +94 -0
- package/dist/lake-storage/lineage.d.ts.map +1 -0
- package/dist/lake-storage/sql-transforms.d.ts +45 -0
- package/dist/lake-storage/sql-transforms.d.ts.map +1 -1
- package/dist/lake-storage/types.d.ts +55 -1
- package/dist/lake-storage/types.d.ts.map +1 -1
- package/dist/lake-storage/version-inputs.d.ts +14 -3
- package/dist/lake-storage/version-inputs.d.ts.map +1 -1
- package/dist/maintenance/ontology-maintenance.d.ts.map +1 -1
- package/dist/materializer/index.js +31 -30
- package/dist/materializer/index.js.map +1 -1
- package/dist/models/execution/index.js +25 -24
- package/dist/models/execution/index.js.map +1 -1
- package/dist/objects/clearance-redaction.d.ts +27 -0
- package/dist/objects/clearance-redaction.d.ts.map +1 -0
- package/dist/objects/index.js +54 -47
- package/dist/objects/index.js.map +1 -1
- package/dist/objects/link/authorization.d.ts +8 -5
- package/dist/objects/link/authorization.d.ts.map +1 -1
- package/dist/objects/link/upsert-batch.d.ts.map +1 -1
- package/dist/objects/object/delete.d.ts.map +1 -1
- package/dist/objects/object/upsert-batch.d.ts.map +1 -1
- package/dist/objects/object/upsert.d.ts.map +1 -1
- package/dist/objects/property-clearance.d.ts +47 -24
- package/dist/objects/property-clearance.d.ts.map +1 -1
- package/dist/objects/query/clearance-admission.d.ts +10 -0
- package/dist/objects/query/clearance-admission.d.ts.map +1 -0
- package/dist/objects/query/index.js +29 -28
- package/dist/objects/query/index.js.map +1 -1
- package/dist/objects/query/link-query-clearance.d.ts +21 -0
- package/dist/objects/query/link-query-clearance.d.ts.map +1 -0
- package/dist/ontology/builders.d.ts.map +1 -1
- package/dist/ontology/docs-markdown.d.ts +1 -1
- package/dist/ontology/docs-markdown.d.ts.map +1 -1
- package/dist/ontology/index.js +7 -7
- package/dist/ontology/internal.js +4 -4
- package/dist/ontology/internal.js.map +1 -1
- package/dist/pipelines/index.d.ts +2 -0
- package/dist/pipelines/index.d.ts.map +1 -1
- package/dist/pipelines/index.js +47 -35
- package/dist/pipelines/index.js.map +1 -1
- package/dist/pipelines/lineage.d.ts +17 -0
- package/dist/pipelines/lineage.d.ts.map +1 -0
- package/dist/projections/internal.d.ts +2 -2
- package/dist/projections/internal.js +30 -29
- package/dist/projections/internal.js.map +1 -1
- package/dist/runtime/create.d.ts +3 -0
- package/dist/runtime/create.d.ts.map +1 -1
- package/dist/runtime/host.d.ts +6 -0
- package/dist/runtime/host.d.ts.map +1 -1
- package/dist/runtime/internal.d.ts +2 -0
- package/dist/runtime/internal.d.ts.map +1 -1
- package/dist/runtime/internal.js +46 -42
- package/dist/runtime/internal.js.map +1 -1
- package/dist/runtime/ontology-mutations.d.ts +2 -0
- package/dist/runtime/ontology-mutations.d.ts.map +1 -1
- package/dist/runtime/resolve-definitions.d.ts.map +1 -1
- package/dist/runtime/sixb.d.ts +8 -0
- package/dist/runtime/sixb.d.ts.map +1 -1
- package/dist/sandboxes/auth.d.ts +16 -0
- package/dist/sandboxes/auth.d.ts.map +1 -1
- package/dist/sandboxes/config.d.ts.map +1 -1
- package/dist/sandboxes/configuration.d.ts +26 -0
- package/dist/sandboxes/configuration.d.ts.map +1 -1
- package/dist/sandboxes/index.d.ts +1 -1
- package/dist/sandboxes/index.d.ts.map +1 -1
- package/dist/sandboxes/index.js +14 -13
- package/dist/sandboxes/index.js.map +1 -1
- package/dist/sandboxes/sandbox.d.ts +28 -5
- package/dist/sandboxes/sandbox.d.ts.map +1 -1
- package/dist/security/applied-markings-contribution.d.ts +58 -0
- package/dist/security/applied-markings-contribution.d.ts.map +1 -0
- package/dist/security/applied-markings-host.d.ts +10 -0
- package/dist/security/applied-markings-host.d.ts.map +1 -0
- package/dist/security/applied-markings-snapshot.d.ts +67 -0
- package/dist/security/applied-markings-snapshot.d.ts.map +1 -0
- package/dist/security/applied-markings.d.ts +73 -0
- package/dist/security/applied-markings.d.ts.map +1 -0
- package/dist/security/dataset-version-markings.d.ts +47 -0
- package/dist/security/dataset-version-markings.d.ts.map +1 -0
- package/dist/security/grants.d.ts +3 -2
- package/dist/security/grants.d.ts.map +1 -1
- package/dist/security/index.d.ts +2 -1
- package/dist/security/index.d.ts.map +1 -1
- package/dist/security/internal.d.ts +15 -0
- package/dist/security/internal.d.ts.map +1 -0
- package/dist/security/internal.js +135 -0
- package/dist/security/internal.js.map +10 -0
- package/dist/security/marking-propagation.d.ts +62 -0
- package/dist/security/marking-propagation.d.ts.map +1 -0
- package/dist/security/marking-sets.d.ts +14 -0
- package/dist/security/marking-sets.d.ts.map +1 -0
- package/dist/security/markings.d.ts +6 -3
- package/dist/security/markings.d.ts.map +1 -1
- package/dist/security/pipeline-markings.d.ts +20 -0
- package/dist/security/pipeline-markings.d.ts.map +1 -0
- package/dist/security/project.d.ts +4 -0
- package/dist/security/project.d.ts.map +1 -0
- package/dist/security/projection-markings.d.ts +71 -0
- package/dist/security/projection-markings.d.ts.map +1 -0
- package/dist/security/public.js +2 -2
- package/dist/security/redactions.d.ts +4 -1
- package/dist/security/redactions.d.ts.map +1 -1
- package/dist/security/types.d.ts +22 -2
- package/dist/security/types.d.ts.map +1 -1
- package/dist/security/validation.d.ts.map +1 -1
- package/dist/shares/internal.js +24 -23
- package/dist/shares/internal.js.map +2 -2
- package/dist/storage/action-runs/failure.js +3 -3
- package/dist/storage/action-runs/in-memory.d.ts +4 -0
- package/dist/storage/action-runs/in-memory.d.ts.map +1 -1
- package/dist/storage/action-runs/types.d.ts +8 -0
- package/dist/storage/action-runs/types.d.ts.map +1 -1
- package/dist/storage/activity/in-memory.d.ts +55 -0
- package/dist/storage/activity/in-memory.d.ts.map +1 -0
- package/dist/storage/activity/index.d.ts +3 -0
- package/dist/storage/activity/index.d.ts.map +1 -0
- package/dist/storage/activity/policy.d.ts +96 -0
- package/dist/storage/activity/policy.d.ts.map +1 -0
- package/dist/storage/activity/types.d.ts +191 -0
- package/dist/storage/activity/types.d.ts.map +1 -0
- package/dist/storage/agents/in-memory.d.ts +4 -0
- package/dist/storage/agents/in-memory.d.ts.map +1 -1
- package/dist/storage/agents/provider.d.ts.map +1 -1
- package/dist/storage/agents/provider.js +2 -5
- package/dist/storage/agents/provider.js.map +1 -1
- package/dist/storage/agents/types.d.ts +9 -8
- package/dist/storage/agents/types.d.ts.map +1 -1
- package/dist/storage/ai-limits/enforcement.js +3 -3
- package/dist/storage/artifacts/errors.d.ts +8 -0
- package/dist/storage/artifacts/errors.d.ts.map +1 -0
- package/dist/storage/artifacts/in-memory.d.ts +34 -0
- package/dist/storage/artifacts/in-memory.d.ts.map +1 -0
- package/dist/storage/artifacts/index.d.ts +5 -0
- package/dist/storage/artifacts/index.d.ts.map +1 -0
- package/dist/storage/artifacts/record.d.ts +17 -0
- package/dist/storage/artifacts/record.d.ts.map +1 -0
- package/dist/storage/artifacts/types.d.ts +184 -0
- package/dist/storage/artifacts/types.d.ts.map +1 -0
- package/dist/storage/auth/in-memory/sessions.d.ts +2 -1
- package/dist/storage/auth/in-memory/sessions.d.ts.map +1 -1
- package/dist/storage/auth/index.d.ts +1 -1
- package/dist/storage/auth/index.d.ts.map +1 -1
- package/dist/storage/auth/types.d.ts +19 -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 +2 -1
- package/dist/storage/executions/in-memory.d.ts.map +1 -1
- package/dist/storage/executions/index.d.ts +1 -1
- package/dist/storage/executions/index.d.ts.map +1 -1
- package/dist/storage/executions/provider.d.ts +2 -0
- package/dist/storage/executions/provider.d.ts.map +1 -1
- package/dist/storage/executions/provider.js +9 -223
- package/dist/storage/executions/provider.js.map +3 -4
- package/dist/storage/executions/types.d.ts +31 -0
- package/dist/storage/executions/types.d.ts.map +1 -1
- package/dist/storage/file-upload-sessions/provider.js +11 -11
- package/dist/storage/in-memory/index.d.ts +8 -0
- package/dist/storage/in-memory/index.d.ts.map +1 -1
- package/dist/storage/index.d.ts +6 -4
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/index.js +54 -53
- package/dist/storage/index.js.map +1 -1
- package/dist/storage/internal.d.ts +3 -0
- package/dist/storage/internal.d.ts.map +1 -1
- package/dist/storage/internal.js +66 -16
- package/dist/storage/internal.js.map +1 -1
- package/dist/storage/ontology/in-memory/sources.d.ts +2 -1
- package/dist/storage/ontology/in-memory/sources.d.ts.map +1 -1
- package/dist/storage/ontology/index.d.ts +1 -1
- package/dist/storage/ontology/index.d.ts.map +1 -1
- package/dist/storage/ontology/sources.d.ts +15 -0
- package/dist/storage/ontology/sources.d.ts.map +1 -1
- package/dist/storage/projection-runs/provider.js +3 -3
- package/dist/storage/share-grants/in-memory.d.ts +2 -1
- package/dist/storage/share-grants/in-memory.d.ts.map +1 -1
- package/dist/storage/share-grants/index.d.ts +1 -1
- package/dist/storage/share-grants/index.d.ts.map +1 -1
- package/dist/storage/share-grants/types.d.ts +6 -0
- package/dist/storage/share-grants/types.d.ts.map +1 -1
- package/dist/storage/types.d.ts +4 -0
- package/dist/storage/types.d.ts.map +1 -1
- package/dist/storage/workflow-runs/in-memory.d.ts +4 -0
- package/dist/storage/workflow-runs/in-memory.d.ts.map +1 -1
- package/dist/storage/workflow-runs/provider.js +13 -12
- package/dist/storage/workflow-runs/provider.js.map +1 -1
- package/dist/storage/workflow-runs/types.d.ts +5 -0
- package/dist/storage/workflow-runs/types.d.ts.map +1 -1
- package/dist/syncs/index.js +35 -34
- package/dist/syncs/index.js.map +1 -1
- package/dist/testing/action-run-storage-contract.d.ts.map +1 -1
- package/dist/testing/activity-storage-contract.d.ts +14 -0
- package/dist/testing/activity-storage-contract.d.ts.map +1 -0
- package/dist/testing/agent-storage-contract.d.ts.map +1 -1
- package/dist/testing/artifact-storage-contract.d.ts +13 -0
- package/dist/testing/artifact-storage-contract.d.ts.map +1 -0
- package/dist/testing/auth-storage-contract.d.ts.map +1 -1
- package/dist/testing/execution-storage-contract.d.ts.map +1 -1
- package/dist/testing/index.d.ts +2 -0
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +4488 -3137
- package/dist/testing/index.js.map +14 -12
- package/dist/testing/lake-merge-storage-contract.d.ts.map +1 -1
- package/dist/testing/lake-storage-contract.d.ts +2 -0
- package/dist/testing/lake-storage-contract.d.ts.map +1 -1
- package/dist/testing/ontology-storage-contract.d.ts.map +1 -1
- package/dist/testing/share-grant-storage-contract.d.ts.map +1 -1
- package/dist/webhooks/internal.js +27 -26
- package/dist/webhooks/internal.js.map +2 -2
- package/dist/workers/index.js +2 -2
- package/dist/workflows/builders.d.ts.map +1 -1
- package/dist/workflows/index.js +57 -51
- package/dist/workflows/index.js.map +1 -1
- package/dist/workflows/types.d.ts +9 -0
- package/dist/workflows/types.d.ts.map +1 -1
- package/dist/workflows/validation.d.ts +7 -0
- package/dist/workflows/validation.d.ts.map +1 -1
- package/package.json +25 -1
- package/src/actions/execution.ts +18 -13
- package/src/actions/request.ts +18 -3
- package/src/actions/run-authorization.ts +23 -0
- package/src/activity/README.md +155 -0
- package/src/activity/connection.ts +217 -0
- package/src/activity/device.ts +41 -0
- package/src/activity/execution.ts +210 -0
- package/src/activity/service.ts +274 -0
- package/src/activity/shares.ts +62 -0
- package/src/activity/timeline.ts +424 -0
- package/src/agents/index.ts +8 -3
- package/src/agents/request.ts +5 -0
- package/src/agents/skills.ts +6 -0
- package/src/agents/types.ts +8 -8
- package/src/agents/validation.ts +2 -0
- package/src/artifacts/address.ts +132 -0
- package/src/artifacts/csv.ts +108 -0
- package/src/artifacts/errors.ts +21 -0
- package/src/artifacts/execution.ts +153 -0
- package/src/artifacts/frames/assets.ts +88 -0
- package/src/artifacts/frames/grants.ts +124 -0
- package/src/artifacts/frames/index.ts +15 -0
- package/src/artifacts/frames/kit.ts +392 -0
- package/src/artifacts/frames/probe.ts +309 -0
- package/src/artifacts/frames/protocol.ts +174 -0
- package/src/artifacts/frames/runtime.ts +213 -0
- package/src/artifacts/html.ts +25 -0
- package/src/artifacts/ids.ts +18 -0
- package/src/artifacts/index.ts +61 -0
- package/src/artifacts/kinds.ts +8 -0
- package/src/artifacts/limits.ts +27 -0
- package/src/artifacts/outline.ts +62 -0
- package/src/artifacts/publish/files.ts +87 -0
- package/src/artifacts/publish/index.ts +12 -0
- package/src/artifacts/publish/publish.ts +250 -0
- package/src/artifacts/publish/references.ts +130 -0
- package/src/artifacts/publish/validate/document.ts +114 -0
- package/src/artifacts/publish/validate/file.ts +19 -0
- package/src/artifacts/publish/validate/sheet.ts +251 -0
- package/src/artifacts/publish/validate/slides.ts +134 -0
- package/src/artifacts/references.ts +11 -0
- package/src/artifacts/resolve.ts +97 -0
- package/src/artifacts/theme.ts +116 -0
- package/src/artifacts/warnings.ts +10 -0
- package/src/artifacts/workbook.ts +315 -0
- package/src/authorization/decision.ts +5 -0
- package/src/authorization/grant-kinds.ts +14 -2
- package/src/blob-storage/internal.ts +1 -1
- package/src/blob-storage/media-type.ts +69 -0
- package/src/datasets/builders.ts +66 -2
- package/src/datasets/column-index.ts +19 -0
- package/src/datasets/execution.ts +23 -9
- package/src/errors/internal.ts +1 -0
- package/src/events/execution.ts +134 -21
- package/src/execution/authorized-object-reader.ts +270 -256
- package/src/execution/object-reader-clearance.ts +91 -0
- package/src/execution/object-reader-ontology.ts +63 -0
- package/src/execution/object-reader-security.ts +146 -0
- package/src/http/api-routes.ts +125 -0
- package/src/index.ts +71 -3
- package/src/lake-storage/in-memory.ts +26 -3
- package/src/lake-storage/index.ts +13 -1
- package/src/lake-storage/lineage.ts +385 -0
- package/src/lake-storage/sql-transforms.ts +45 -0
- package/src/lake-storage/types.ts +59 -1
- package/src/lake-storage/version-inputs.ts +35 -6
- package/src/maintenance/ontology-maintenance.ts +15 -0
- package/src/objects/clearance-redaction.ts +138 -0
- package/src/objects/link/authorization.ts +27 -7
- package/src/objects/link/remove.ts +2 -2
- package/src/objects/link/upsert-batch.ts +7 -5
- package/src/objects/link/upsert.ts +2 -2
- package/src/objects/object/delete.ts +2 -0
- package/src/objects/object/upsert-batch.ts +2 -4
- package/src/objects/object/upsert.ts +2 -3
- package/src/objects/property-clearance.ts +171 -152
- package/src/objects/query/clearance-admission.ts +112 -0
- package/src/objects/query/link-query-clearance.ts +73 -0
- package/src/ontology/builders.ts +12 -1
- package/src/ontology/docs-markdown.ts +1 -1
- package/src/pipelines/index.ts +2 -0
- package/src/pipelines/lineage.ts +45 -0
- package/src/projections/internal.ts +2 -2
- package/src/runtime/create.ts +4 -0
- package/src/runtime/host.ts +55 -0
- package/src/runtime/internal.ts +2 -0
- package/src/runtime/ontology-mutations.ts +19 -4
- package/src/runtime/resolve-definitions.ts +66 -3
- package/src/runtime/sixb.ts +18 -1
- package/src/sandboxes/README.md +29 -7
- package/src/sandboxes/auth.ts +16 -0
- package/src/sandboxes/config.ts +2 -7
- package/src/sandboxes/configuration.ts +61 -7
- package/src/sandboxes/index.ts +1 -0
- package/src/sandboxes/sandbox.ts +27 -5
- package/src/security/applied-markings-contribution.ts +277 -0
- package/src/security/applied-markings-host.ts +41 -0
- package/src/security/applied-markings-snapshot.ts +235 -0
- package/src/security/applied-markings.ts +405 -0
- package/src/security/dataset-version-markings.ts +163 -0
- package/src/security/grants.ts +39 -4
- package/src/security/index.ts +3 -0
- package/src/security/internal.ts +18 -0
- package/src/security/marking-propagation.ts +255 -0
- package/src/security/marking-sets.ts +42 -0
- package/src/security/markings.ts +29 -178
- package/src/security/pipeline-markings.ts +175 -0
- package/src/security/project.ts +8 -0
- package/src/security/projection-markings.ts +421 -0
- package/src/security/redactions.ts +7 -2
- package/src/security/types.ts +20 -2
- package/src/security/validation.ts +11 -4
- package/src/storage/action-runs/in-memory.ts +18 -0
- package/src/storage/action-runs/types.ts +8 -0
- package/src/storage/activity/in-memory.ts +374 -0
- package/src/storage/activity/index.ts +27 -0
- package/src/storage/activity/policy.ts +430 -0
- package/src/storage/activity/types.ts +211 -0
- package/src/storage/agents/in-memory.ts +10 -0
- package/src/storage/agents/provider.ts +2 -13
- package/src/storage/agents/types.ts +9 -16
- package/src/storage/artifacts/errors.ts +16 -0
- package/src/storage/artifacts/in-memory.ts +240 -0
- package/src/storage/artifacts/index.ts +30 -0
- package/src/storage/artifacts/record.ts +200 -0
- package/src/storage/artifacts/types.ts +209 -0
- package/src/storage/auth/in-memory/sessions.ts +21 -0
- package/src/storage/auth/index.ts +2 -0
- package/src/storage/auth/types.ts +18 -0
- package/src/storage/executions/in-memory.ts +61 -1
- package/src/storage/executions/index.ts +3 -0
- package/src/storage/executions/provider.ts +12 -0
- package/src/storage/executions/types.ts +30 -0
- package/src/storage/in-memory/index.ts +16 -0
- package/src/storage/index.ts +63 -0
- package/src/storage/internal.ts +30 -0
- package/src/storage/ontology/in-memory/sources.ts +23 -0
- package/src/storage/ontology/index.ts +2 -0
- package/src/storage/ontology/sources.ts +17 -0
- package/src/storage/share-grants/in-memory.ts +8 -0
- package/src/storage/share-grants/index.ts +1 -0
- package/src/storage/share-grants/types.ts +8 -0
- package/src/storage/types.ts +4 -0
- package/src/storage/workflow-runs/in-memory.ts +16 -0
- package/src/storage/workflow-runs/types.ts +5 -0
- package/src/testing/action-run-storage-contract.ts +25 -0
- package/src/testing/activity-storage-contract.ts +840 -0
- package/src/testing/agent-storage-contract.ts +22 -21
- package/src/testing/artifact-storage-contract.ts +517 -0
- package/src/testing/auth-storage-contract.ts +47 -0
- package/src/testing/execution-storage-contract.ts +147 -1
- package/src/testing/index.ts +9 -0
- package/src/testing/lake-merge-storage-contract.ts +38 -0
- package/src/testing/lake-storage-contract.ts +247 -2
- package/src/testing/materializer-storage-contract.ts +1 -0
- package/src/testing/ontology-storage-contract.ts +57 -2
- package/src/testing/share-grant-storage-contract.ts +15 -0
- package/src/workflows/builders.ts +14 -0
- package/src/workflows/types.ts +9 -0
- package/src/workflows/validation.ts +72 -0
- package/dist/chunk-1k89ecfr.js +0 -85
- package/dist/chunk-1k89ecfr.js.map +0 -10
- package/dist/chunk-3t2hgbgd.js.map +0 -15
- package/dist/chunk-4vyr1j8f.js +0 -128
- package/dist/chunk-4vyr1j8f.js.map +0 -11
- package/dist/chunk-9gyp8hg1.js +0 -363
- package/dist/chunk-9gyp8hg1.js.map +0 -14
- package/dist/chunk-es1gxsbf.js.map +0 -13
- package/dist/chunk-gsjm1wms.js.map +0 -10
- package/dist/chunk-hkc3jct7.js.map +0 -10
- package/dist/chunk-k6q3n2sc.js.map +0 -12
- package/dist/chunk-rrzt8jdy.js.map +0 -14
- package/dist/chunk-s16apyk9.js +0 -256
- package/dist/chunk-s16apyk9.js.map +0 -16
- package/dist/chunk-s54c868q.js.map +0 -12
- package/dist/chunk-tw03bsmb.js.map +0 -11
- /package/dist/{chunk-xfs8x8m9.js.map → chunk-0bphap9y.js.map} +0 -0
- /package/dist/{chunk-1zq2p6g0.js.map → chunk-1cc1xaf3.js.map} +0 -0
- /package/dist/{chunk-t7x8dmn0.js.map → chunk-431pyp2c.js.map} +0 -0
- /package/dist/{chunk-c85m1hyj.js.map → chunk-447a5c0p.js.map} +0 -0
- /package/dist/{chunk-ren4kg2j.js.map → chunk-561r0yc9.js.map} +0 -0
- /package/dist/{chunk-5e43w60z.js.map → chunk-5948n82c.js.map} +0 -0
- /package/dist/{chunk-yzwja0mj.js.map → chunk-5hx48dnn.js.map} +0 -0
- /package/dist/{chunk-5j58wjct.js.map → chunk-858emn8m.js.map} +0 -0
- /package/dist/{chunk-6p49a5cq.js.map → chunk-c1rxbz5y.js.map} +0 -0
- /package/dist/{chunk-gc4ntf7d.js.map → chunk-cwdzcv37.js.map} +0 -0
- /package/dist/{chunk-fa02jy15.js.map → chunk-cy4mbddw.js.map} +0 -0
- /package/dist/{chunk-9w055r5b.js.map → chunk-d09e3rax.js.map} +0 -0
- /package/dist/{chunk-dk8tkk5f.js.map → chunk-d7dnxdep.js.map} +0 -0
- /package/dist/{chunk-tg2cw67r.js.map → chunk-ky3j490c.js.map} +0 -0
- /package/dist/{chunk-vyf9kfqf.js.map → chunk-q7gn29y3.js.map} +0 -0
- /package/dist/{chunk-v9xd5wzd.js.map → chunk-s7jg7pmn.js.map} +0 -0
- /package/dist/{chunk-9dmt152s.js.map → chunk-vf57cr4t.js.map} +0 -0
- /package/dist/{chunk-9ybhtmg4.js.map → chunk-vvxtn22d.js.map} +0 -0
- /package/dist/{chunk-7t429e3f.js.map → chunk-xvsc5m8n.js.map} +0 -0
- /package/dist/{chunk-z4m0yz8c.js.map → chunk-y5tah2kf.js.map} +0 -0
- /package/dist/{chunk-fkgc1wt8.js.map → chunk-z58tm0hm.js.map} +0 -0
|
@@ -0,0 +1,430 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The activity rules every provider shares: validation, retries, quota, visit assignment and
|
|
3
|
+
* sequence. Providers own atomicity and their queries; see `src/activity/README.md`.
|
|
4
|
+
*/
|
|
5
|
+
import type {
|
|
6
|
+
ActivityActor,
|
|
7
|
+
ActivityAttribution,
|
|
8
|
+
ActivityDay,
|
|
9
|
+
ActivityEventInput,
|
|
10
|
+
ActivityInteraction,
|
|
11
|
+
ActivityPageView,
|
|
12
|
+
AppendActivityInput,
|
|
13
|
+
} from "./types"
|
|
14
|
+
|
|
15
|
+
// The HTTP schemas share these, so the API and the providers refuse the same inputs.
|
|
16
|
+
export const ACTIVITY_BATCH_LIMIT = 20
|
|
17
|
+
export const ACTIVITY_EVENT_ID_PATTERN = /^[a-zA-Z0-9_-]{1,80}$/
|
|
18
|
+
export const ACTIVITY_VISIT_ID_PATTERN = /^[a-zA-Z0-9_-]{1,128}$/
|
|
19
|
+
export const ACTIVITY_HOSTNAME_PATTERN =
|
|
20
|
+
/^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)*[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/
|
|
21
|
+
/** A UTM label: any text without control characters. */
|
|
22
|
+
export const ACTIVITY_LABEL_PATTERN = /^[^\x00-\x1f\x7f]*$/
|
|
23
|
+
export const ACTIVITY_LABEL_MAX_LENGTH = 100
|
|
24
|
+
export const ACTIVITY_REFERRER_MAX_LENGTH = 253
|
|
25
|
+
export const ACTIVITY_ROUTE_MAX_LENGTH = 512
|
|
26
|
+
export const ACTIVITY_ID_MAX_LENGTH = 256
|
|
27
|
+
/**
|
|
28
|
+
* An interaction name: lowercase dotted segments, each starting with a letter and at most 40
|
|
29
|
+
* characters, such as `invoices.row.open`, without a run of four digits. A segment that starts
|
|
30
|
+
* with a digit, or holds a long number, is usually a value, which names never carry. No pattern
|
|
31
|
+
* catches every value: names are meant to be constants.
|
|
32
|
+
*/
|
|
33
|
+
export const ACTIVITY_INTERACTION_NAME_PATTERN =
|
|
34
|
+
/^(?!.*\d{4})[a-z][a-z0-9_-]{0,39}(?:\.[a-z][a-z0-9_-]{0,39})*$/
|
|
35
|
+
export const ACTIVITY_INTERACTION_NAME_MAX_LENGTH = 100
|
|
36
|
+
export const ACTIVITY_MAX_PERIOD_MS = 31 * 24 * 60 * 60_000
|
|
37
|
+
export const ACTIVITY_MAX_PAGE_SIZE = 100
|
|
38
|
+
|
|
39
|
+
export const ACTIVITY_SOURCE_LIMIT_PER_MINUTE = 120
|
|
40
|
+
export const ACTIVITY_MIN_IDLE_TIMEOUT_MS = 60_000
|
|
41
|
+
/** A visit ends at its next event once this old, so a period query bounds `started_at`. */
|
|
42
|
+
export const ACTIVITY_MAX_VISIT_MS = 24 * 60 * 60_000
|
|
43
|
+
|
|
44
|
+
const QUOTA_WINDOW_MS = 60_000
|
|
45
|
+
const DAY_MS = 86_400_000
|
|
46
|
+
const ATTRIBUTION_KEYS = ["source", "medium", "campaign", "referrer"] as const
|
|
47
|
+
|
|
48
|
+
/** What a provider keeps per session between batches, read and written under its lock. */
|
|
49
|
+
export interface ActivitySourceState {
|
|
50
|
+
readonly visitId: string
|
|
51
|
+
/** When the current visit started; `null` once that visit was deleted. Epoch milliseconds. */
|
|
52
|
+
readonly visitStartedAt: number | null
|
|
53
|
+
/** Epoch milliseconds. Never moves backwards. */
|
|
54
|
+
readonly lastSeenAt: number
|
|
55
|
+
/** Sequence of the visit's last stored event, page view or interaction. */
|
|
56
|
+
readonly sequence: number
|
|
57
|
+
readonly windowStart: number
|
|
58
|
+
readonly windowCount: number
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** A page view or an interaction already stored for the session, compared with a retry of it. */
|
|
62
|
+
export interface StoredActivityEvent {
|
|
63
|
+
readonly id: string
|
|
64
|
+
readonly route: string
|
|
65
|
+
/** Set for an interaction only. */
|
|
66
|
+
readonly name?: string
|
|
67
|
+
readonly attribution?: ActivityAttribution
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** A page view to insert. Its own attribution is kept only to recognize a retry. */
|
|
71
|
+
export interface PlannedActivityPageView extends ActivityPageView {
|
|
72
|
+
readonly attribution?: ActivityAttribution
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export type ActivityAppendPlan =
|
|
76
|
+
| { readonly status: "duplicate" }
|
|
77
|
+
| { readonly status: "throttled" }
|
|
78
|
+
| {
|
|
79
|
+
readonly status: "append"
|
|
80
|
+
/** Set when the batch starts a visit, with the arrival that visit keeps. */
|
|
81
|
+
readonly newVisit: { readonly attribution: ActivityAttribution | null } | null
|
|
82
|
+
readonly pageViews: readonly PlannedActivityPageView[]
|
|
83
|
+
readonly interactions: readonly ActivityInteraction[]
|
|
84
|
+
/** Events counted against the quota: page views, activity and interactions alike. */
|
|
85
|
+
readonly accepted: number
|
|
86
|
+
readonly state: ActivitySourceState
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export function validateActivityEvents(events: readonly ActivityEventInput[]): void {
|
|
90
|
+
if (!Array.isArray(events) || events.length === 0 || events.length > ACTIVITY_BATCH_LIMIT) {
|
|
91
|
+
throw new Error(`[Sixb] Activity batches must contain 1 to ${ACTIVITY_BATCH_LIMIT} events.`)
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const ids = new Set<string>()
|
|
95
|
+
for (const event of events) {
|
|
96
|
+
if (
|
|
97
|
+
!event ||
|
|
98
|
+
typeof event.id !== "string" ||
|
|
99
|
+
!ACTIVITY_EVENT_ID_PATTERN.test(event.id) ||
|
|
100
|
+
ids.has(event.id)
|
|
101
|
+
) {
|
|
102
|
+
throw new Error("[Sixb] Activity event ids must be unique, nonempty identifiers.")
|
|
103
|
+
}
|
|
104
|
+
ids.add(event.id)
|
|
105
|
+
|
|
106
|
+
if (
|
|
107
|
+
event.type !== "page.view" &&
|
|
108
|
+
event.type !== "visit.activity" &&
|
|
109
|
+
event.type !== "ui.interaction"
|
|
110
|
+
) {
|
|
111
|
+
throw new Error("[Sixb] Unknown activity event type.")
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
if (!isActivityRoutePattern(event.route)) {
|
|
115
|
+
throw new Error(
|
|
116
|
+
"[Sixb] Activity routes must be normalized file-router patterns without URL parameters."
|
|
117
|
+
)
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
if (event.type !== "ui.interaction") {
|
|
121
|
+
serializeActivityAttribution(event.attribution)
|
|
122
|
+
continue
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
if (!isActivityInteractionName(event.name)) {
|
|
126
|
+
throw new Error(
|
|
127
|
+
`[Sixb] Activity interaction names are lowercase dotted identifiers such as "invoices.export": each segment starts with a letter, holds at most 40 characters and no run of four digits, and the name at most ${ACTIVITY_INTERACTION_NAME_MAX_LENGTH}.`
|
|
128
|
+
)
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// An interaction is its name, route and time: the arrival travels with page views.
|
|
132
|
+
if (Reflect.get(event, "attribution") !== undefined) {
|
|
133
|
+
throw new Error("[Sixb] Activity interactions carry no attribution.")
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export function validateActivityAppend(input: AppendActivityInput): void {
|
|
139
|
+
validateActivityEvents(input.events)
|
|
140
|
+
|
|
141
|
+
if (input.actor.type !== "user" && input.actor.type !== "share") {
|
|
142
|
+
throw new Error("[Sixb] Invalid activity actor.")
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
const actorId = input.actor.type === "user" ? input.actor.userId : input.actor.grantId
|
|
146
|
+
for (const value of [input.projectId, input.sessionId, input.newVisitId, actorId]) {
|
|
147
|
+
if (typeof value !== "string" || !value.trim() || value.length > ACTIVITY_ID_MAX_LENGTH) {
|
|
148
|
+
throw new Error("[Sixb] Invalid activity identity.")
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
if (
|
|
153
|
+
!Number.isFinite(input.now.getTime()) ||
|
|
154
|
+
!Number.isSafeInteger(input.idleTimeoutMs) ||
|
|
155
|
+
input.idleTimeoutMs < ACTIVITY_MIN_IDLE_TIMEOUT_MS
|
|
156
|
+
) {
|
|
157
|
+
throw new Error("[Sixb] Invalid activity clock or inactivity window.")
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Plans one batch for one session. `current` is the session's state, absent before its first
|
|
163
|
+
* batch; `stored` holds its page views and interactions whose ids appear in the batch.
|
|
164
|
+
*/
|
|
165
|
+
export function planActivityAppend(
|
|
166
|
+
input: AppendActivityInput,
|
|
167
|
+
current: ActivitySourceState | undefined,
|
|
168
|
+
stored: readonly StoredActivityEvent[]
|
|
169
|
+
): ActivityAppendPlan {
|
|
170
|
+
const fresh = input.events.filter((event) => !isRetry(event, stored))
|
|
171
|
+
if (fresh.length === 0) {
|
|
172
|
+
return { status: "duplicate" }
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
// A server clock stepping back must not reorder a visit.
|
|
176
|
+
const now = Math.max(input.now.getTime(), current?.lastSeenAt ?? 0)
|
|
177
|
+
|
|
178
|
+
const windowOpen = current !== undefined && now - current.windowStart < QUOTA_WINDOW_MS
|
|
179
|
+
const windowStart = windowOpen ? current.windowStart : now
|
|
180
|
+
const windowCount = windowOpen ? current.windowCount : 0
|
|
181
|
+
if (windowCount + fresh.length > ACTIVITY_SOURCE_LIMIT_PER_MINUTE) {
|
|
182
|
+
return { status: "throttled" }
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
const continued = continuesVisit(current, now, input.idleTimeoutMs) ? current : undefined
|
|
186
|
+
const visitId = continued?.visitId ?? input.newVisitId
|
|
187
|
+
const previousSequence = continued?.sequence ?? 0
|
|
188
|
+
|
|
189
|
+
// Page views and interactions share the visit's sequence, in the order the batch sent them.
|
|
190
|
+
const pageViews: PlannedActivityPageView[] = []
|
|
191
|
+
const interactions: ActivityInteraction[] = []
|
|
192
|
+
let sequence = previousSequence
|
|
193
|
+
|
|
194
|
+
fresh.forEach((event, index) => {
|
|
195
|
+
const receivedAt = new Date(now)
|
|
196
|
+
const opensVisit = !continued && index === 0
|
|
197
|
+
|
|
198
|
+
if (event.type === "ui.interaction") {
|
|
199
|
+
// Like activity, an interaction that opens a visit starts it on its page. The page view's
|
|
200
|
+
// id is derived outside the event-id alphabet, so no browser event can claim it.
|
|
201
|
+
if (opensVisit) {
|
|
202
|
+
sequence += 1
|
|
203
|
+
pageViews.push({
|
|
204
|
+
id: `${event.id}.page`,
|
|
205
|
+
visitId,
|
|
206
|
+
sequence,
|
|
207
|
+
route: event.route,
|
|
208
|
+
receivedAt,
|
|
209
|
+
attribution: {},
|
|
210
|
+
})
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
sequence += 1
|
|
214
|
+
interactions.push({
|
|
215
|
+
id: event.id,
|
|
216
|
+
visitId,
|
|
217
|
+
sequence,
|
|
218
|
+
name: event.name,
|
|
219
|
+
route: event.route,
|
|
220
|
+
receivedAt,
|
|
221
|
+
})
|
|
222
|
+
return
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
// A visit opened by activity, someone back on a page after inactivity, starts on that page.
|
|
226
|
+
if (event.type === "page.view" || opensVisit) {
|
|
227
|
+
sequence += 1
|
|
228
|
+
pageViews.push({
|
|
229
|
+
id: event.id,
|
|
230
|
+
visitId,
|
|
231
|
+
sequence,
|
|
232
|
+
route: event.route,
|
|
233
|
+
receivedAt,
|
|
234
|
+
...(event.attribution === undefined
|
|
235
|
+
? {}
|
|
236
|
+
: { attribution: structuredClone(event.attribution) }),
|
|
237
|
+
})
|
|
238
|
+
}
|
|
239
|
+
})
|
|
240
|
+
|
|
241
|
+
// An interaction carries no arrival: the visit it opens reads as direct.
|
|
242
|
+
const first = fresh[0]
|
|
243
|
+
const arrival = first?.type === "ui.interaction" ? {} : first?.attribution
|
|
244
|
+
|
|
245
|
+
return {
|
|
246
|
+
status: "append",
|
|
247
|
+
newVisit: continued ? null : { attribution: cloneAttribution(arrival) },
|
|
248
|
+
pageViews,
|
|
249
|
+
interactions,
|
|
250
|
+
accepted: fresh.length,
|
|
251
|
+
state: {
|
|
252
|
+
visitId,
|
|
253
|
+
visitStartedAt: continued ? continued.visitStartedAt : now,
|
|
254
|
+
lastSeenAt: now,
|
|
255
|
+
sequence,
|
|
256
|
+
windowStart,
|
|
257
|
+
windowCount: windowCount + fresh.length,
|
|
258
|
+
},
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* A visit continues while it is active and younger than a day. One whose row was deleted cannot:
|
|
264
|
+
* the next event starts another.
|
|
265
|
+
*/
|
|
266
|
+
function continuesVisit(
|
|
267
|
+
current: ActivitySourceState | undefined,
|
|
268
|
+
now: number,
|
|
269
|
+
idleTimeoutMs: number
|
|
270
|
+
): current is ActivitySourceState {
|
|
271
|
+
return (
|
|
272
|
+
current !== undefined &&
|
|
273
|
+
current.visitStartedAt !== null &&
|
|
274
|
+
now - current.lastSeenAt < idleTimeoutMs &&
|
|
275
|
+
now - current.visitStartedAt < ACTIVITY_MAX_VISIT_MS
|
|
276
|
+
)
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* An event whose id is already stored is a retry, and must say the same thing. Stored rows are
|
|
281
|
+
* page views, the activity that opened a visit, and interactions; either of the first two types
|
|
282
|
+
* can retry a page view. Other activity is not stored, and is never recognized as a retry.
|
|
283
|
+
*/
|
|
284
|
+
function isRetry(event: ActivityEventInput, stored: readonly StoredActivityEvent[]): boolean {
|
|
285
|
+
const previous = stored.find((candidate) => candidate.id === event.id)
|
|
286
|
+
if (!previous) {
|
|
287
|
+
return false
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
const same =
|
|
291
|
+
event.type === "ui.interaction"
|
|
292
|
+
? event.name === previous.name && event.route === previous.route
|
|
293
|
+
: previous.name === undefined &&
|
|
294
|
+
event.route === previous.route &&
|
|
295
|
+
serializeActivityAttribution(event.attribution) ===
|
|
296
|
+
serializeActivityAttribution(previous.attribution)
|
|
297
|
+
|
|
298
|
+
if (!same) {
|
|
299
|
+
throw new Error("[Sixb] Activity event id was reused with different content.")
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
return true
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
* Each UTC day of `[from, to)` that a visit overlaps, with its page views. A visit across midnight
|
|
307
|
+
* counts on both days.
|
|
308
|
+
*/
|
|
309
|
+
export function activityCalendarDays(
|
|
310
|
+
period: { readonly from: Date; readonly to: Date },
|
|
311
|
+
visits: readonly { readonly startedAt: Date; readonly lastSeenAt: Date }[],
|
|
312
|
+
pageViewsByDay: ReadonlyMap<string, number>
|
|
313
|
+
): ActivityDay[] {
|
|
314
|
+
const visitsByDay = new Map<string, number>()
|
|
315
|
+
const from = period.from.getTime()
|
|
316
|
+
const last = period.to.getTime() - 1
|
|
317
|
+
|
|
318
|
+
for (const visit of visits) {
|
|
319
|
+
const firstDay = Math.floor(Math.max(visit.startedAt.getTime(), from) / DAY_MS)
|
|
320
|
+
const lastDay = Math.floor(Math.min(visit.lastSeenAt.getTime(), last) / DAY_MS)
|
|
321
|
+
|
|
322
|
+
for (let day = firstDay; day <= lastDay; day++) {
|
|
323
|
+
const key = activityDay(day * DAY_MS)
|
|
324
|
+
visitsByDay.set(key, (visitsByDay.get(key) ?? 0) + 1)
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
const days = new Set([...visitsByDay.keys(), ...pageViewsByDay.keys()])
|
|
329
|
+
return [...days].sort().map((day) => ({
|
|
330
|
+
day,
|
|
331
|
+
visits: visitsByDay.get(day) ?? 0,
|
|
332
|
+
pageViews: pageViewsByDay.get(day) ?? 0,
|
|
333
|
+
}))
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
/** The UTC calendar day of an instant, as `YYYY-MM-DD`. */
|
|
337
|
+
export function activityDay(at: Date | number): string {
|
|
338
|
+
return new Date(at).toISOString().slice(0, 10)
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
export function activityActor(
|
|
342
|
+
type: string,
|
|
343
|
+
userId: string | null,
|
|
344
|
+
grantId: string | null
|
|
345
|
+
): ActivityActor {
|
|
346
|
+
if (type === "user" && userId) {
|
|
347
|
+
return { type, userId }
|
|
348
|
+
}
|
|
349
|
+
if (type === "share" && grantId) {
|
|
350
|
+
return { type, grantId }
|
|
351
|
+
}
|
|
352
|
+
throw new Error("[Sixb] Stored activity actor is invalid.")
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
/** Canonical JSON, so a retry matches whatever order its keys come in. `undefined` stays null. */
|
|
356
|
+
export function serializeActivityAttribution(value: unknown): string | null {
|
|
357
|
+
if (value === undefined) {
|
|
358
|
+
return null
|
|
359
|
+
}
|
|
360
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
361
|
+
throw new Error("[Sixb] Invalid activity attribution.")
|
|
362
|
+
}
|
|
363
|
+
if (Object.keys(value).some((key) => !ATTRIBUTION_KEYS.some((field) => field === key))) {
|
|
364
|
+
throw new Error("[Sixb] Unknown activity attribution field.")
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
const result: Record<string, string> = {}
|
|
368
|
+
for (const key of ATTRIBUTION_KEYS) {
|
|
369
|
+
const text: unknown = Reflect.get(value, key)
|
|
370
|
+
if (text === undefined) {
|
|
371
|
+
continue
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
const maxLength = key === "referrer" ? ACTIVITY_REFERRER_MAX_LENGTH : ACTIVITY_LABEL_MAX_LENGTH
|
|
375
|
+
if (!isAttributionLabel(text, maxLength)) {
|
|
376
|
+
throw new Error("[Sixb] Activity attribution requires bounded, nonempty labels.")
|
|
377
|
+
}
|
|
378
|
+
if (key === "referrer" && !ACTIVITY_HOSTNAME_PATTERN.test(text)) {
|
|
379
|
+
throw new Error("[Sixb] Activity referrer must be a hostname, not a URL.")
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
result[key] = text
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
return JSON.stringify(result)
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
export function parseActivityAttribution(value: string | null): ActivityAttribution | null {
|
|
389
|
+
if (value === null) {
|
|
390
|
+
return null
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
const data: unknown = JSON.parse(value)
|
|
394
|
+
serializeActivityAttribution(data)
|
|
395
|
+
// The check above limits every key and value to the attribution contract.
|
|
396
|
+
return data as ActivityAttribution
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
function cloneAttribution(value: ActivityAttribution | undefined): ActivityAttribution | null {
|
|
400
|
+
return value === undefined ? null : structuredClone(value)
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
function isAttributionLabel(value: unknown, maxLength: number): value is string {
|
|
404
|
+
return (
|
|
405
|
+
typeof value === "string" &&
|
|
406
|
+
value.length > 0 &&
|
|
407
|
+
value.length <= maxLength &&
|
|
408
|
+
value === value.trim() &&
|
|
409
|
+
ACTIVITY_LABEL_PATTERN.test(value)
|
|
410
|
+
)
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
function isActivityInteractionName(value: unknown): value is string {
|
|
414
|
+
return (
|
|
415
|
+
typeof value === "string" &&
|
|
416
|
+
value.length <= ACTIVITY_INTERACTION_NAME_MAX_LENGTH &&
|
|
417
|
+
ACTIVITY_INTERACTION_NAME_PATTERN.test(value)
|
|
418
|
+
)
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
/** A file-router pattern: rooted, normalized, without a query, fragment or escape. */
|
|
422
|
+
export function isActivityRoutePattern(value: unknown): value is string {
|
|
423
|
+
return (
|
|
424
|
+
typeof value === "string" &&
|
|
425
|
+
value.length <= ACTIVITY_ROUTE_MAX_LENGTH &&
|
|
426
|
+
value.startsWith("/") &&
|
|
427
|
+
!value.includes("//") &&
|
|
428
|
+
!/[?#%\s\x00-\x1f]/.test(value)
|
|
429
|
+
)
|
|
430
|
+
}
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
/** Who a visit belongs to: the verified account, or the share grant a link opened. */
|
|
2
|
+
export type ActivityActor =
|
|
3
|
+
| { readonly type: "user"; readonly userId: string }
|
|
4
|
+
| { readonly type: "share"; readonly grantId: string }
|
|
5
|
+
|
|
6
|
+
/** Arrival metadata. An empty object means direct; `null` means it was not collected. */
|
|
7
|
+
export interface ActivityAttribution {
|
|
8
|
+
readonly source?: string
|
|
9
|
+
readonly medium?: string
|
|
10
|
+
readonly campaign?: string
|
|
11
|
+
/** External hostname only, without path, query, credentials or fragment. */
|
|
12
|
+
readonly referrer?: string
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* `page.view` is a load or a navigation, and is kept. `visit.activity` is foreground activity: it
|
|
17
|
+
* keeps the visit alive and is not stored. `ui.interaction` is something the app marked, such as a
|
|
18
|
+
* button: it is kept, and keeps the visit alive.
|
|
19
|
+
*/
|
|
20
|
+
export type ActivityEventType = "page.view" | "visit.activity" | "ui.interaction"
|
|
21
|
+
|
|
22
|
+
export type ActivityEventInput =
|
|
23
|
+
| {
|
|
24
|
+
/** Chosen by the browser, so a retried event is recognized. */
|
|
25
|
+
readonly id: string
|
|
26
|
+
readonly type: "page.view" | "visit.activity"
|
|
27
|
+
/** File-router pattern, never a concrete URL, search string, title, or DOM content. */
|
|
28
|
+
readonly route: string
|
|
29
|
+
readonly attribution?: ActivityAttribution
|
|
30
|
+
}
|
|
31
|
+
| {
|
|
32
|
+
readonly id: string
|
|
33
|
+
readonly type: "ui.interaction"
|
|
34
|
+
/** Chosen by the app's developer, such as `invoices.export`; never a value. */
|
|
35
|
+
readonly name: string
|
|
36
|
+
/** The route pattern shown when it happened. */
|
|
37
|
+
readonly route: string
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface ActivityVisit {
|
|
41
|
+
readonly id: string
|
|
42
|
+
readonly actor: ActivityActor
|
|
43
|
+
/** Fixed by the first accepted event of the visit. */
|
|
44
|
+
readonly attribution: ActivityAttribution | null
|
|
45
|
+
readonly startedAt: Date
|
|
46
|
+
readonly lastSeenAt: Date
|
|
47
|
+
/** Every page view of the visit, including those outside the period that listed it. */
|
|
48
|
+
readonly pageViews: number
|
|
49
|
+
/** Every interaction of the visit, likewise. */
|
|
50
|
+
readonly interactions: number
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface ActivityPageView {
|
|
54
|
+
readonly id: string
|
|
55
|
+
readonly visitId: string
|
|
56
|
+
/** Position in the visit, from 1. Interactions take positions in the same order. */
|
|
57
|
+
readonly sequence: number
|
|
58
|
+
readonly route: string
|
|
59
|
+
/** Server receipt time. Browser delivery is best effort, not an audit trail. */
|
|
60
|
+
readonly receivedAt: Date
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** An interaction the app marked: its name, and the page it happened on. */
|
|
64
|
+
export interface ActivityInteraction {
|
|
65
|
+
readonly id: string
|
|
66
|
+
readonly visitId: string
|
|
67
|
+
/** Position in the visit, from 1, in the same order as its page views. */
|
|
68
|
+
readonly sequence: number
|
|
69
|
+
readonly name: string
|
|
70
|
+
readonly route: string
|
|
71
|
+
/** Server receipt time. */
|
|
72
|
+
readonly receivedAt: Date
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export interface AppendActivityInput {
|
|
76
|
+
readonly projectId: string
|
|
77
|
+
readonly actor: ActivityActor
|
|
78
|
+
/**
|
|
79
|
+
* The verified session the events came through: the `SessionRecord` id for a user, the shared
|
|
80
|
+
* session's id for a share. Stored on the visit and never returned by reads.
|
|
81
|
+
*/
|
|
82
|
+
readonly sessionId: string
|
|
83
|
+
readonly events: readonly ActivityEventInput[]
|
|
84
|
+
readonly now: Date
|
|
85
|
+
readonly idleTimeoutMs: number
|
|
86
|
+
/** Used only when this batch starts a visit. */
|
|
87
|
+
readonly newVisitId: string
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export interface AppendActivityResult {
|
|
91
|
+
readonly status: "accepted" | "throttled"
|
|
92
|
+
/** Events taken into account; a retried page view or interaction counts zero. */
|
|
93
|
+
readonly accepted: number
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/** Visits overlapping `[from, to)`, and page views received in it. */
|
|
97
|
+
export interface ActivityPeriodInput {
|
|
98
|
+
readonly projectId: string
|
|
99
|
+
readonly from: Date
|
|
100
|
+
readonly to: Date
|
|
101
|
+
/** Only this account's visits; a share is never counted as a user. */
|
|
102
|
+
readonly userId?: string
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/** Continue after this row of a list ordered by last activity, newest first. */
|
|
106
|
+
export interface ActivityCursor {
|
|
107
|
+
readonly at: Date
|
|
108
|
+
readonly id: string
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export interface ListActivityVisitsInput extends ActivityPeriodInput {
|
|
112
|
+
readonly limit: number
|
|
113
|
+
readonly before?: ActivityCursor
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export interface ActivityVisitsPage {
|
|
117
|
+
readonly visits: readonly ActivityVisit[]
|
|
118
|
+
readonly hasMore: boolean
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export interface ListActivityUsersInput extends ActivityPeriodInput {
|
|
122
|
+
readonly limit: number
|
|
123
|
+
/** `id` is the user id of the last row. */
|
|
124
|
+
readonly before?: ActivityCursor
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export interface ActivityUser {
|
|
128
|
+
readonly userId: string
|
|
129
|
+
readonly lastSeenAt: Date
|
|
130
|
+
readonly visits: number
|
|
131
|
+
/** Page views received in the period. */
|
|
132
|
+
readonly pageViews: number
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export interface ActivityUsersPage {
|
|
136
|
+
readonly users: readonly ActivityUser[]
|
|
137
|
+
readonly hasMore: boolean
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export interface ActivitySummary {
|
|
141
|
+
/** Distinct accounts; shares are not identities, so they never count here. */
|
|
142
|
+
readonly users: number
|
|
143
|
+
readonly visits: number
|
|
144
|
+
readonly sharedVisits: number
|
|
145
|
+
/** Page views received in the period. */
|
|
146
|
+
readonly pageViews: number
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export interface ActivityCalendarInput {
|
|
150
|
+
readonly projectId: string
|
|
151
|
+
readonly userId: string
|
|
152
|
+
readonly from: Date
|
|
153
|
+
readonly to: Date
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/** One UTC day with activity. A visit across midnight counts on both days. */
|
|
157
|
+
export interface ActivityDay {
|
|
158
|
+
/** `YYYY-MM-DD`, in UTC. */
|
|
159
|
+
readonly day: string
|
|
160
|
+
readonly visits: number
|
|
161
|
+
readonly pageViews: number
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export interface ReadActivityVisitInput {
|
|
165
|
+
readonly projectId: string
|
|
166
|
+
readonly id: string
|
|
167
|
+
/** Page views and interactions kept together, from the first. */
|
|
168
|
+
readonly limit: number
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/** A visit as core reads it, with the session it belongs to. `sixb.activity` never returns it. */
|
|
172
|
+
export interface StoredActivityVisitPage {
|
|
173
|
+
readonly visit: ActivityVisit
|
|
174
|
+
readonly sessionId: string
|
|
175
|
+
/** Its first page views and interactions, by their shared sequence. */
|
|
176
|
+
readonly pageViews: readonly ActivityPageView[]
|
|
177
|
+
readonly interactions: readonly ActivityInteraction[]
|
|
178
|
+
readonly hasMore: boolean
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
export interface ListActivitySessionVisitsInput {
|
|
182
|
+
readonly projectId: string
|
|
183
|
+
readonly userId: string
|
|
184
|
+
/** The account's `SessionRecord` ids. */
|
|
185
|
+
readonly sessionIds: readonly string[]
|
|
186
|
+
/** Latest visits kept per session. */
|
|
187
|
+
readonly limit: number
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
export interface ActivitySessionVisits {
|
|
191
|
+
readonly sessionId: string
|
|
192
|
+
/** Every visit the session opened. */
|
|
193
|
+
readonly visits: number
|
|
194
|
+
/** Its latest visits by start, newest first, at most `limit`. */
|
|
195
|
+
readonly latest: readonly ActivityVisit[]
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
export interface ActivityStorage {
|
|
199
|
+
/**
|
|
200
|
+
* Assigns the visit, deduplicates and counts the session's quota atomically, including across API
|
|
201
|
+
* replicas. Participates in the storage transaction it runs in.
|
|
202
|
+
*/
|
|
203
|
+
append(input: AppendActivityInput): Promise<AppendActivityResult>
|
|
204
|
+
list(input: ListActivityVisitsInput): Promise<ActivityVisitsPage>
|
|
205
|
+
users(input: ListActivityUsersInput): Promise<ActivityUsersPage>
|
|
206
|
+
summarize(input: ActivityPeriodInput): Promise<ActivitySummary>
|
|
207
|
+
calendar(input: ActivityCalendarInput): Promise<readonly ActivityDay[]>
|
|
208
|
+
read(input: ReadActivityVisitInput): Promise<StoredActivityVisitPage | null>
|
|
209
|
+
/** The visits of these sessions of one account. A session without any is omitted. */
|
|
210
|
+
sessionVisits(input: ListActivitySessionVisitsInput): Promise<readonly ActivitySessionVisits[]>
|
|
211
|
+
}
|
|
@@ -173,6 +173,16 @@ class InMemoryAgentThreadStore implements AgentThreadStore {
|
|
|
173
173
|
return record ? clone(record) : null
|
|
174
174
|
}
|
|
175
175
|
|
|
176
|
+
async getByIds(params: {
|
|
177
|
+
readonly projectId: string
|
|
178
|
+
readonly ids: readonly string[]
|
|
179
|
+
}): Promise<readonly AgentThreadRecord[]> {
|
|
180
|
+
return [...new Set(params.ids)].flatMap((id) => {
|
|
181
|
+
const record = this.state.threads.get(key(params.projectId, id))
|
|
182
|
+
return record ? [clone(record)] : []
|
|
183
|
+
})
|
|
184
|
+
}
|
|
185
|
+
|
|
176
186
|
async list(input: ListAgentThreadsInput): Promise<ListAgentThreadsResult> {
|
|
177
187
|
const order = input.order ?? "desc"
|
|
178
188
|
const statuses = input.statuses ? new Set(input.statuses) : null
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { isDeepStrictEqual } from "node:util"
|
|
2
2
|
import { AGENT_REASONING_LEVELS } from "../../agents/types"
|
|
3
|
-
import { isFileRef } from "../../blob-storage"
|
|
4
3
|
import { isJsonObject, isPlainRecord } from "../../json"
|
|
5
4
|
import { isModelReasoning } from "../../models/language-model"
|
|
6
5
|
import type { ExecutionRecord, ExecutionStorage } from "../executions"
|
|
@@ -275,20 +274,10 @@ export function assertSubagentRunResult(
|
|
|
275
274
|
runId: string,
|
|
276
275
|
prefix = "Sixb"
|
|
277
276
|
): asserts result is SubagentRunResult {
|
|
278
|
-
|
|
279
|
-
const files = result?.files
|
|
280
|
-
const hasText = typeof text === "string" && text.trim().length > 0
|
|
281
|
-
const hasFiles = Array.isArray(files) && files.length > 0 && files.every(isFileRef)
|
|
282
|
-
if (!result || (!hasText && !hasFiles)) {
|
|
277
|
+
if (typeof result?.text !== "string" || result.text.trim().length === 0) {
|
|
283
278
|
throw new AgentStorageError(
|
|
284
279
|
"invalid_input",
|
|
285
|
-
`[${prefix}] Succeeded subagent run '${runId}' requires text
|
|
286
|
-
)
|
|
287
|
-
}
|
|
288
|
-
if ((text !== undefined && !hasText) || (files !== undefined && !hasFiles)) {
|
|
289
|
-
throw new AgentStorageError(
|
|
290
|
-
"invalid_input",
|
|
291
|
-
`[${prefix}] Subagent run '${runId}' has an invalid result.`
|
|
280
|
+
`[${prefix}] Succeeded subagent run '${runId}' requires text.`
|
|
292
281
|
)
|
|
293
282
|
}
|
|
294
283
|
}
|