@sixb/core 0.1.4 → 0.1.6
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/index.d.ts +2 -2
- package/dist/actions/index.d.ts.map +1 -1
- package/dist/actions/index.js +8 -8
- package/dist/actions/read-facade.d.ts +10 -2
- package/dist/actions/read-facade.d.ts.map +1 -1
- package/dist/actions/types/context.d.ts +45 -2
- package/dist/actions/types/context.d.ts.map +1 -1
- package/dist/actions/types/definitions.d.ts +8 -2
- package/dist/actions/types/definitions.d.ts.map +1 -1
- package/dist/agents/index.js +13 -13
- package/dist/agents/types.d.ts +2 -0
- package/dist/agents/types.d.ts.map +1 -1
- package/dist/agents/validation.d.ts.map +1 -1
- package/dist/auth/index.d.ts +1 -1
- package/dist/auth/index.d.ts.map +1 -1
- package/dist/auth/index.js +1 -1
- package/dist/auth/runtime.d.ts.map +1 -1
- package/dist/auth/strategy.d.ts +1 -1
- package/dist/auth/strategy.d.ts.map +1 -1
- package/dist/auth/types.d.ts +13 -0
- package/dist/auth/types.d.ts.map +1 -1
- package/dist/bootstrap/index.js +17 -17
- package/dist/{chunk-tycbzedm.js → chunk-0hc5j867.js} +68 -3
- package/dist/chunk-0hc5j867.js.map +15 -0
- package/dist/{chunk-tkdscva6.js → chunk-1e8m6yn3.js} +6 -1
- package/dist/{chunk-tkdscva6.js.map → chunk-1e8m6yn3.js.map} +4 -4
- package/dist/{chunk-xdf9yswn.js → chunk-1g8negke.js} +1 -1
- package/dist/{chunk-s31d0qmq.js → chunk-5gynx4xn.js} +11 -11
- package/dist/{chunk-s31d0qmq.js.map → chunk-5gynx4xn.js.map} +1 -1
- package/dist/{chunk-pn8n8sba.js → chunk-5sxb1168.js} +7 -11
- package/dist/{chunk-pn8n8sba.js.map → chunk-5sxb1168.js.map} +3 -4
- package/dist/chunk-72q2y8hn.js.map +3 -3
- package/dist/{chunk-cbkm2vam.js → chunk-8gv5z0zm.js} +1 -1
- package/dist/{chunk-tek1qwgm.js → chunk-a44d5zgd.js} +8 -3
- package/dist/{chunk-tek1qwgm.js.map → chunk-a44d5zgd.js.map} +4 -3
- package/dist/{chunk-1yz3x65y.js → chunk-dy311asx.js} +7 -9
- package/dist/{chunk-1yz3x65y.js.map → chunk-dy311asx.js.map} +2 -2
- package/dist/{chunk-rs1wbvy6.js → chunk-e42bc6m3.js} +1 -1
- package/dist/{chunk-a09jx26t.js → chunk-fe5ev6mr.js} +1 -1
- package/dist/{chunk-nzw7sm3b.js → chunk-hceck7dq.js} +1 -1
- package/dist/{chunk-7gw7mepb.js → chunk-md8k0r54.js} +1 -1
- package/dist/{chunk-hbeh8j9w.js → chunk-n4spznws.js} +2 -2
- package/dist/{chunk-afjpa2hs.js → chunk-nkbfrt0c.js} +1 -1
- package/dist/{chunk-c43qr6s0.js → chunk-nva1xkjz.js} +16 -12
- package/dist/{chunk-c43qr6s0.js.map → chunk-nva1xkjz.js.map} +4 -4
- package/dist/{chunk-1wk20wn3.js → chunk-t624af60.js} +37 -35
- package/dist/{chunk-1wk20wn3.js.map → chunk-t624af60.js.map} +4 -4
- package/dist/{chunk-g13869yf.js → chunk-tg5mee00.js} +1 -1
- package/dist/{chunk-sxwk41qa.js → chunk-znagycq7.js} +1 -1
- package/dist/execution/agent.js +13 -13
- package/dist/execution/primitive.js +13 -13
- package/dist/execution/request.js +13 -13
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +21 -21
- package/dist/index.js.map +1 -1
- package/dist/materializer/index.js +6 -6
- package/dist/objects/index.js +9 -9
- package/dist/objects/query/index.js +6 -6
- package/dist/ontology/internal.d.ts +1 -1
- package/dist/ontology/internal.d.ts.map +1 -1
- package/dist/ontology/internal.js +14 -6
- package/dist/ontology/internal.js.map +3 -3
- package/dist/ontology/json-schema.d.ts +10 -0
- package/dist/ontology/json-schema.d.ts.map +1 -1
- package/dist/pipelines/index.js +7 -7
- package/dist/projections/internal.js +5 -5
- package/dist/storage/agents/provider.js +3 -3
- package/dist/storage/index.d.ts +1 -1
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/index.js +5 -5
- package/dist/storage/ontology/in-memory/materializations.d.ts +4 -3
- package/dist/storage/ontology/in-memory/materializations.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/materializations.d.ts +7 -3
- package/dist/storage/ontology/materializations.d.ts.map +1 -1
- package/dist/storage/ontology/provider.d.ts +2 -2
- package/dist/storage/ontology/provider.d.ts.map +1 -1
- package/dist/storage/workflow-runs/provider.js +3 -3
- package/dist/syncs/index.js +7 -7
- package/dist/testing/index.js +159 -21
- package/dist/testing/index.js.map +3 -3
- package/dist/testing/materializer-storage-contract.d.ts.map +1 -1
- package/dist/webhooks/internal.js +5 -5
- package/dist/workflows/index.js +14 -14
- package/package.json +1 -1
- package/src/actions/index.ts +10 -1
- package/src/actions/read-facade.ts +125 -3
- package/src/actions/types/context.ts +69 -2
- package/src/actions/types/definitions.ts +24 -2
- package/src/agents/types.ts +2 -0
- package/src/agents/validation.ts +4 -0
- package/src/auth/index.ts +1 -0
- package/src/auth/runtime.ts +8 -0
- package/src/auth/strategy.ts +1 -0
- package/src/auth/types.ts +14 -0
- package/src/index.ts +5 -0
- package/src/ontology/internal.ts +1 -1
- package/src/ontology/json-schema.ts +27 -5
- package/src/storage/index.ts +1 -0
- package/src/storage/ontology/in-memory/materializations.ts +34 -22
- package/src/storage/ontology/index.ts +1 -0
- package/src/storage/ontology/materializations.ts +8 -3
- package/src/storage/ontology/provider.ts +2 -2
- package/src/storage/timeseries/store.ts +6 -6
- package/src/testing/materializer-storage-contract.ts +170 -2
- package/dist/chunk-tycbzedm.js.map +0 -15
- /package/dist/{chunk-xdf9yswn.js.map → chunk-1g8negke.js.map} +0 -0
- /package/dist/{chunk-cbkm2vam.js.map → chunk-8gv5z0zm.js.map} +0 -0
- /package/dist/{chunk-rs1wbvy6.js.map → chunk-e42bc6m3.js.map} +0 -0
- /package/dist/{chunk-a09jx26t.js.map → chunk-fe5ev6mr.js.map} +0 -0
- /package/dist/{chunk-nzw7sm3b.js.map → chunk-hceck7dq.js.map} +0 -0
- /package/dist/{chunk-7gw7mepb.js.map → chunk-md8k0r54.js.map} +0 -0
- /package/dist/{chunk-hbeh8j9w.js.map → chunk-n4spznws.js.map} +0 -0
- /package/dist/{chunk-afjpa2hs.js.map → chunk-nkbfrt0c.js.map} +0 -0
- /package/dist/{chunk-g13869yf.js.map → chunk-tg5mee00.js.map} +0 -0
- /package/dist/{chunk-sxwk41qa.js.map → chunk-znagycq7.js.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"materializer-storage-contract.d.ts","sourceRoot":"","sources":["../../src/testing/materializer-storage-contract.ts"],"names":[],"mappings":"AACA,OAAO,EASL,KAAK,OAAO,EACb,MAAM,IAAI,CAAA;
|
|
1
|
+
{"version":3,"file":"materializer-storage-contract.d.ts","sourceRoot":"","sources":["../../src/testing/materializer-storage-contract.ts"],"names":[],"mappings":"AACA,OAAO,EASL,KAAK,OAAO,EACb,MAAM,IAAI,CAAA;AAgBX,MAAM,WAAW,mCAAmC,CAAC,QAAQ,SAAS,OAAO;IAC3E,QAAQ,CAAC,aAAa,EAAE,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAA;IAC1D,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,QAAQ,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CAC/D;AA6FD,wBAAgB,mCAAmC,CAAC,QAAQ,SAAS,OAAO,EAC1E,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,mCAAmC,CAAC,QAAQ,CAAC,GACtD,IAAI,CA6lBN"}
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
import {
|
|
6
6
|
canRetryWebhookRun,
|
|
7
7
|
isStorageSerializationFailure
|
|
8
|
-
} from "../chunk-
|
|
8
|
+
} from "../chunk-t624af60.js";
|
|
9
9
|
import"../chunk-72q2y8hn.js";
|
|
10
10
|
import"../chunk-xc7hq65b.js";
|
|
11
11
|
import"../chunk-cy0n5dms.js";
|
|
@@ -14,11 +14,11 @@ import"../chunk-62c7t4jc.js";
|
|
|
14
14
|
import {
|
|
15
15
|
WebhookRunError
|
|
16
16
|
} from "../chunk-ezake7g1.js";
|
|
17
|
-
import"../chunk-
|
|
17
|
+
import"../chunk-fe5ev6mr.js";
|
|
18
18
|
import"../chunk-htq0qh7z.js";
|
|
19
19
|
import"../chunk-xkthy56g.js";
|
|
20
|
-
import"../chunk-
|
|
21
|
-
import"../chunk-
|
|
20
|
+
import"../chunk-1g8negke.js";
|
|
21
|
+
import"../chunk-hceck7dq.js";
|
|
22
22
|
import"../chunk-t9xghkva.js";
|
|
23
23
|
import"../chunk-drjqm1aa.js";
|
|
24
24
|
import"../chunk-5gd7tpv6.js";
|
|
@@ -32,7 +32,7 @@ import"../chunk-3j7573mj.js";
|
|
|
32
32
|
import"../chunk-4gz41why.js";
|
|
33
33
|
import"../chunk-zcnhxkvd.js";
|
|
34
34
|
import"../chunk-t0jjkep3.js";
|
|
35
|
-
import"../chunk-
|
|
35
|
+
import"../chunk-1e8m6yn3.js";
|
|
36
36
|
import"../chunk-rhrbz7d4.js";
|
|
37
37
|
import"../chunk-xwnf87e1.js";
|
|
38
38
|
import"../chunk-f83ka50g.js";
|
package/dist/workflows/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
defineWorkflowStep,
|
|
8
8
|
interventionField,
|
|
9
9
|
unwrapWorkflowNodeFailure
|
|
10
|
-
} from "../chunk-
|
|
10
|
+
} from "../chunk-n4spznws.js";
|
|
11
11
|
import"../chunk-5sz8ta9r.js";
|
|
12
12
|
import"../chunk-979ww6b3.js";
|
|
13
13
|
import"../chunk-74drx9gd.js";
|
|
@@ -40,36 +40,36 @@ import {
|
|
|
40
40
|
validateWorkflowStepInput,
|
|
41
41
|
validateWorkflowStepOutput,
|
|
42
42
|
validateWorkflowsAtStartup
|
|
43
|
-
} from "../chunk-
|
|
44
|
-
import"../chunk-
|
|
45
|
-
import"../chunk-
|
|
46
|
-
import"../chunk-
|
|
43
|
+
} from "../chunk-nva1xkjz.js";
|
|
44
|
+
import"../chunk-tg5mee00.js";
|
|
45
|
+
import"../chunk-8gv5z0zm.js";
|
|
46
|
+
import"../chunk-5sxb1168.js";
|
|
47
47
|
import"../chunk-4rh2m6zg.js";
|
|
48
48
|
import"../chunk-xhy826cz.js";
|
|
49
|
-
import"../chunk-
|
|
49
|
+
import"../chunk-md8k0r54.js";
|
|
50
50
|
import"../chunk-rte5sm3z.js";
|
|
51
51
|
import"../chunk-qewtks41.js";
|
|
52
52
|
import"../chunk-8b55ygje.js";
|
|
53
53
|
import"../chunk-51fjndv0.js";
|
|
54
54
|
import"../chunk-8m5ejdpn.js";
|
|
55
55
|
import"../chunk-nf4r78r4.js";
|
|
56
|
-
import"../chunk-
|
|
57
|
-
import"../chunk-
|
|
58
|
-
import"../chunk-
|
|
56
|
+
import"../chunk-0hc5j867.js";
|
|
57
|
+
import"../chunk-a44d5zgd.js";
|
|
58
|
+
import"../chunk-nkbfrt0c.js";
|
|
59
59
|
import"../chunk-96swp2wd.js";
|
|
60
60
|
import"../chunk-f6erf2vv.js";
|
|
61
|
-
import"../chunk-
|
|
61
|
+
import"../chunk-t624af60.js";
|
|
62
62
|
import"../chunk-72q2y8hn.js";
|
|
63
63
|
import"../chunk-xc7hq65b.js";
|
|
64
64
|
import"../chunk-cy0n5dms.js";
|
|
65
65
|
import"../chunk-dysw7nsm.js";
|
|
66
66
|
import"../chunk-62c7t4jc.js";
|
|
67
67
|
import"../chunk-ezake7g1.js";
|
|
68
|
-
import"../chunk-
|
|
68
|
+
import"../chunk-fe5ev6mr.js";
|
|
69
69
|
import"../chunk-htq0qh7z.js";
|
|
70
70
|
import"../chunk-xkthy56g.js";
|
|
71
|
-
import"../chunk-
|
|
72
|
-
import"../chunk-
|
|
71
|
+
import"../chunk-1g8negke.js";
|
|
72
|
+
import"../chunk-hceck7dq.js";
|
|
73
73
|
import"../chunk-t9xghkva.js";
|
|
74
74
|
import"../chunk-drjqm1aa.js";
|
|
75
75
|
import"../chunk-5gd7tpv6.js";
|
|
@@ -87,7 +87,7 @@ import"../chunk-yt8wphsx.js";
|
|
|
87
87
|
import"../chunk-rdeagz6b.js";
|
|
88
88
|
import"../chunk-dm72y8wt.js";
|
|
89
89
|
import"../chunk-t0jjkep3.js";
|
|
90
|
-
import"../chunk-
|
|
90
|
+
import"../chunk-1e8m6yn3.js";
|
|
91
91
|
import"../chunk-rhrbz7d4.js";
|
|
92
92
|
import"../chunk-xwnf87e1.js";
|
|
93
93
|
import"../chunk-f83ka50g.js";
|
package/package.json
CHANGED
package/src/actions/index.ts
CHANGED
|
@@ -7,7 +7,11 @@ export type {
|
|
|
7
7
|
} from "./commit-edits"
|
|
8
8
|
export { commitActionEdits, findActionEditCommit } from "./commit-edits"
|
|
9
9
|
export { ActionDefinitionError, ActionEditCommitError } from "./errors"
|
|
10
|
-
export type {
|
|
10
|
+
export type {
|
|
11
|
+
ActionReadFacadeOptions,
|
|
12
|
+
ActionReadObjectSetSource,
|
|
13
|
+
ActionTelemetryReadSource,
|
|
14
|
+
} from "./read-facade"
|
|
11
15
|
export { ActionReadRecorder, createActionReadFacade } from "./read-facade"
|
|
12
16
|
export type { ActionDefinitionCatalog, ActionRegistryOptions } from "./registry"
|
|
13
17
|
export { ActionRegistry } from "./registry"
|
|
@@ -40,7 +44,12 @@ export type {
|
|
|
40
44
|
ActionRuntimeFacade,
|
|
41
45
|
ActionSubject,
|
|
42
46
|
ActionTargetObject,
|
|
47
|
+
ActionTelemetryHistoryBatchInput,
|
|
48
|
+
ActionTelemetryHistoryBatchResult,
|
|
49
|
+
ActionTelemetryHistorySeriesInput,
|
|
43
50
|
ActionTelemetryObjectSet,
|
|
51
|
+
ActionTelemetryPropertyToken,
|
|
52
|
+
ActionTelemetryReadFacade,
|
|
44
53
|
ActionValidationContext,
|
|
45
54
|
ActionValidator,
|
|
46
55
|
ActionWritebackContext,
|
|
@@ -8,12 +8,28 @@ import type {
|
|
|
8
8
|
OntologyObjectRef,
|
|
9
9
|
} from "../materializer"
|
|
10
10
|
import { createLinkScopeFingerprint } from "../materializer"
|
|
11
|
+
import { OntologyValidationError } from "../ontology/errors"
|
|
11
12
|
import type { ObjectTypeWithPropertyTokens } from "../ontology/tokens"
|
|
12
13
|
import type { ValueType } from "../ontology/types"
|
|
14
|
+
import {
|
|
15
|
+
assertPropertyTokenBelongsToObjectType,
|
|
16
|
+
assertTelemetryProperty,
|
|
17
|
+
} from "../ontology/validation"
|
|
18
|
+
import { RuntimeError } from "../runtime/errors"
|
|
13
19
|
import type { ObjectSetListInput } from "../runtime/types"
|
|
14
|
-
import type {
|
|
20
|
+
import type {
|
|
21
|
+
ObjectLinkRow,
|
|
22
|
+
ObjectRow,
|
|
23
|
+
TimeseriesHistoryBatchInput,
|
|
24
|
+
TimeseriesHistoryBatchResult,
|
|
25
|
+
} from "../storage"
|
|
15
26
|
import type { ActionReadDependencies } from "./commit-edits"
|
|
16
|
-
import type {
|
|
27
|
+
import type {
|
|
28
|
+
ActionReadFacade,
|
|
29
|
+
ActionReadObjectSet,
|
|
30
|
+
ActionTelemetryHistorySeriesInput,
|
|
31
|
+
ActionTelemetryReadFacade,
|
|
32
|
+
} from "./types"
|
|
17
33
|
|
|
18
34
|
export type ActionReadObjectSetSource = {
|
|
19
35
|
get(id: string): Promise<unknown>
|
|
@@ -25,13 +41,22 @@ export type ActionReadObjectSetSource = {
|
|
|
25
41
|
}
|
|
26
42
|
}
|
|
27
43
|
|
|
44
|
+
/** Runtime leaves used by the Action telemetry read adapter. */
|
|
45
|
+
export interface ActionTelemetryReadSource {
|
|
46
|
+
readonly resolveObjectType: (objectTypeId: string) => ObjectTypeWithPropertyTokens
|
|
47
|
+
readonly getHistoryBatch: (
|
|
48
|
+
input: Omit<TimeseriesHistoryBatchInput, "projectId">
|
|
49
|
+
) => Promise<readonly TimeseriesHistoryBatchResult[]>
|
|
50
|
+
}
|
|
51
|
+
|
|
28
52
|
/**
|
|
29
53
|
* Records the exact state an Action handler observed while reading.
|
|
30
54
|
*
|
|
31
55
|
* A handler that reads one dependency twice keeps the first observation: the commit must fail when
|
|
32
56
|
* current state no longer matches what the decision was made against, and the later read may already
|
|
33
57
|
* reflect the handler's own intent. Arbitrary query phantoms stay out of this release — `query()` and
|
|
34
|
-
* `list()` results are not turned into dependencies.
|
|
58
|
+
* `list()` results are not turned into dependencies. Telemetry history is also a call-level snapshot,
|
|
59
|
+
* not an edit dependency.
|
|
35
60
|
*/
|
|
36
61
|
export class ActionReadRecorder {
|
|
37
62
|
private readonly objects = new Map<string, ExpectedObjectRevision>()
|
|
@@ -130,6 +155,8 @@ export interface ActionReadFacadeOptions {
|
|
|
130
155
|
* recorded scopes.
|
|
131
156
|
*/
|
|
132
157
|
readonly resolveLinkIds: (objectTypeId: string) => readonly string[]
|
|
158
|
+
/** Canonical authorized telemetry history leaf. Omitted only by isolated facade consumers. */
|
|
159
|
+
readonly telemetry?: ActionTelemetryReadSource
|
|
133
160
|
}
|
|
134
161
|
|
|
135
162
|
export function createActionReadFacade(
|
|
@@ -139,6 +166,7 @@ export function createActionReadFacade(
|
|
|
139
166
|
options?: ActionReadFacadeOptions
|
|
140
167
|
): ActionReadFacade {
|
|
141
168
|
const facade = {
|
|
169
|
+
telemetry: createActionTelemetryReadFacade(options?.telemetry),
|
|
142
170
|
objects<const TObjectType extends ObjectTypeWithPropertyTokens>(objectType: TObjectType) {
|
|
143
171
|
return createActionReadObjectSetAdapter<TObjectType>(
|
|
144
172
|
objectType,
|
|
@@ -151,6 +179,100 @@ export function createActionReadFacade(
|
|
|
151
179
|
return facade as ActionReadFacade
|
|
152
180
|
}
|
|
153
181
|
|
|
182
|
+
function createActionTelemetryReadFacade(
|
|
183
|
+
source: ActionTelemetryReadSource | undefined
|
|
184
|
+
): ActionTelemetryReadFacade<readonly ValueType[]> {
|
|
185
|
+
const facade = {
|
|
186
|
+
async historyBatch(input: {
|
|
187
|
+
readonly series: readonly ActionTelemetryHistorySeriesInput[]
|
|
188
|
+
readonly from?: Date
|
|
189
|
+
readonly to?: Date
|
|
190
|
+
readonly limitPerSeries?: number
|
|
191
|
+
readonly order?: "asc" | "desc"
|
|
192
|
+
}) {
|
|
193
|
+
if (!source) {
|
|
194
|
+
throw new RuntimeError(
|
|
195
|
+
"[Sixb] Action telemetry history requires a configured telemetry read source."
|
|
196
|
+
)
|
|
197
|
+
}
|
|
198
|
+
if (input.series.length === 0) {
|
|
199
|
+
return []
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
const requestedSeries = input.series.map((entry) => {
|
|
203
|
+
const objectType = source.resolveObjectType(entry.property.objectTypeId)
|
|
204
|
+
assertPropertyTokenBelongsToObjectType(objectType, entry.property)
|
|
205
|
+
const registeredProperty = objectType.properties.find(
|
|
206
|
+
(property) => property.id === entry.property.id
|
|
207
|
+
)
|
|
208
|
+
if (!registeredProperty) {
|
|
209
|
+
throw new OntologyValidationError(
|
|
210
|
+
`[Sixb] Unknown property '${entry.property.id}' for object type '${objectType.id}'`
|
|
211
|
+
)
|
|
212
|
+
}
|
|
213
|
+
assertTelemetryProperty(registeredProperty)
|
|
214
|
+
return {
|
|
215
|
+
objectTypeId: objectType.id,
|
|
216
|
+
objectId: entry.objectId,
|
|
217
|
+
propertyId: registeredProperty.id,
|
|
218
|
+
}
|
|
219
|
+
})
|
|
220
|
+
|
|
221
|
+
const results = await source.getHistoryBatch({
|
|
222
|
+
series: requestedSeries,
|
|
223
|
+
...(input.from !== undefined ? { from: input.from } : {}),
|
|
224
|
+
...(input.to !== undefined ? { to: input.to } : {}),
|
|
225
|
+
...(input.limitPerSeries !== undefined ? { limitPerSeries: input.limitPerSeries } : {}),
|
|
226
|
+
...(input.order !== undefined ? { order: input.order } : {}),
|
|
227
|
+
})
|
|
228
|
+
assertTelemetryBatchResultMatchesRequest(requestedSeries, results)
|
|
229
|
+
|
|
230
|
+
return input.series.map((entry, index) => ({
|
|
231
|
+
objectId: entry.objectId,
|
|
232
|
+
property: entry.property,
|
|
233
|
+
points: results[index].points.map((point) => ({
|
|
234
|
+
value: point.value,
|
|
235
|
+
at: point.at,
|
|
236
|
+
...(point.unit !== undefined ? { unit: point.unit } : {}),
|
|
237
|
+
})),
|
|
238
|
+
}))
|
|
239
|
+
},
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
// Cast needed at the generic token boundary: the implementation deliberately manipulates raw
|
|
243
|
+
// provider values while the public facade maps every tuple position back to its property token.
|
|
244
|
+
return facade as unknown as ActionTelemetryReadFacade<readonly ValueType[]>
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
function assertTelemetryBatchResultMatchesRequest(
|
|
248
|
+
requested: readonly {
|
|
249
|
+
readonly objectTypeId: string
|
|
250
|
+
readonly objectId: string
|
|
251
|
+
readonly propertyId: string
|
|
252
|
+
}[],
|
|
253
|
+
results: readonly TimeseriesHistoryBatchResult[]
|
|
254
|
+
): void {
|
|
255
|
+
if (results.length !== requested.length) {
|
|
256
|
+
throw new RuntimeError(
|
|
257
|
+
`[Sixb] Telemetry history provider returned ${results.length} batch results for ${requested.length} requested series.`
|
|
258
|
+
)
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
for (let index = 0; index < requested.length; index += 1) {
|
|
262
|
+
const expected = requested[index]
|
|
263
|
+
const actual = results[index]
|
|
264
|
+
if (
|
|
265
|
+
actual.objectTypeId !== expected.objectTypeId ||
|
|
266
|
+
actual.objectId !== expected.objectId ||
|
|
267
|
+
actual.propertyId !== expected.propertyId
|
|
268
|
+
) {
|
|
269
|
+
throw new RuntimeError(
|
|
270
|
+
`[Sixb] Telemetry history provider returned an unexpected series at batch index ${index}.`
|
|
271
|
+
)
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
|
|
154
276
|
function createActionReadObjectSetAdapter<TObjectType extends ObjectTypeWithPropertyTokens>(
|
|
155
277
|
objectType: TObjectType,
|
|
156
278
|
objectSet: ActionReadObjectSetSource,
|
|
@@ -7,8 +7,9 @@ import type {
|
|
|
7
7
|
EffectiveObjectChange,
|
|
8
8
|
OntologyOperationOutcome,
|
|
9
9
|
} from "../../materializer"
|
|
10
|
-
import type { ObjectType, ValueType } from "../../ontology"
|
|
11
|
-
import type {
|
|
10
|
+
import type { ObjectType, Property, ValueType } from "../../ontology"
|
|
11
|
+
import type { InferPropertyUnit, InferPropertyValue } from "../../ontology/inference"
|
|
12
|
+
import type { LinkToken, ObjectTypeWithPropertyTokens, PropertyToken } from "../../ontology/tokens"
|
|
12
13
|
import type {
|
|
13
14
|
ListResult,
|
|
14
15
|
ObjectQueryBuilder,
|
|
@@ -103,7 +104,73 @@ export interface ActionReadObjectSet<
|
|
|
103
104
|
byId(id: string): ActionReadObjectByIdHandle<TObjectType, TValueTypes>
|
|
104
105
|
}
|
|
105
106
|
|
|
107
|
+
/** A telemetry-mode ontology property accepted by Action history reads. */
|
|
108
|
+
export type ActionTelemetryPropertyToken = PropertyToken<
|
|
109
|
+
string,
|
|
110
|
+
string,
|
|
111
|
+
Property & { readonly mode: "telemetry" }
|
|
112
|
+
>
|
|
113
|
+
|
|
114
|
+
export type ActionTelemetryHistorySeriesInput<
|
|
115
|
+
TProperty extends ActionTelemetryPropertyToken = ActionTelemetryPropertyToken,
|
|
116
|
+
> = {
|
|
117
|
+
readonly objectId: string
|
|
118
|
+
readonly property: TProperty
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export interface ActionTelemetryHistoryBatchInput<
|
|
122
|
+
TSeries extends
|
|
123
|
+
readonly ActionTelemetryHistorySeriesInput[] = readonly ActionTelemetryHistorySeriesInput[],
|
|
124
|
+
> {
|
|
125
|
+
/** Series are returned in this exact order, including duplicate entries. */
|
|
126
|
+
readonly series: TSeries
|
|
127
|
+
readonly from?: Date
|
|
128
|
+
readonly to?: Date
|
|
129
|
+
/** Optional cap applied independently to every requested series. */
|
|
130
|
+
readonly limitPerSeries?: number
|
|
131
|
+
/** Points are oldest first by default. */
|
|
132
|
+
readonly order?: "asc" | "desc"
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* One batch result per requested series, preserving tuple positions and property-specific types.
|
|
137
|
+
*/
|
|
138
|
+
export type ActionTelemetryHistoryBatchResult<
|
|
139
|
+
TSeries extends
|
|
140
|
+
readonly ActionTelemetryHistorySeriesInput[] = readonly ActionTelemetryHistorySeriesInput[],
|
|
141
|
+
TValueTypes extends readonly ValueType[] = readonly ValueType[],
|
|
142
|
+
> = {
|
|
143
|
+
readonly [TIndex in keyof TSeries]: TSeries[TIndex] extends ActionTelemetryHistorySeriesInput<
|
|
144
|
+
infer TProperty
|
|
145
|
+
>
|
|
146
|
+
? {
|
|
147
|
+
readonly objectId: TSeries[TIndex]["objectId"]
|
|
148
|
+
readonly property: TProperty
|
|
149
|
+
readonly points: readonly {
|
|
150
|
+
readonly value: InferPropertyValue<TProperty["property"], TValueTypes>
|
|
151
|
+
readonly at: Date
|
|
152
|
+
readonly unit?: InferPropertyUnit<TProperty["property"], TValueTypes>
|
|
153
|
+
}[]
|
|
154
|
+
}
|
|
155
|
+
: never
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export type ActionTelemetryReadFacade<
|
|
159
|
+
TValueTypes extends readonly ValueType[] = readonly ValueType[],
|
|
160
|
+
> = {
|
|
161
|
+
/**
|
|
162
|
+
* Read several telemetry series in one provider call.
|
|
163
|
+
*
|
|
164
|
+
* This is a snapshot read for the call. It is intentionally not added to the Action edit
|
|
165
|
+
* dependency fence; use a fixed `to` cutoff to keep the report window stable across retries.
|
|
166
|
+
*/
|
|
167
|
+
historyBatch<const TSeries extends readonly ActionTelemetryHistorySeriesInput[]>(
|
|
168
|
+
input: ActionTelemetryHistoryBatchInput<TSeries>
|
|
169
|
+
): Promise<ActionTelemetryHistoryBatchResult<TSeries, TValueTypes>>
|
|
170
|
+
}
|
|
171
|
+
|
|
106
172
|
export interface ActionReadFacade<TValueTypes extends readonly ValueType[] = readonly ValueType[]> {
|
|
173
|
+
readonly telemetry: ActionTelemetryReadFacade<TValueTypes>
|
|
107
174
|
objects<const TObjectType extends ObjectTypeWithPropertyTokens>(
|
|
108
175
|
objectType: TObjectType
|
|
109
176
|
): ActionReadObjectSet<TObjectType, TValueTypes, ObjectTypeWithPropertyTokens>
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ReadonlyJsonValue } from "../../json"
|
|
1
2
|
import type { ObjectTypeWithPropertyTokens } from "../../ontology/tokens"
|
|
2
3
|
import type {
|
|
3
4
|
ActionEditsHandler,
|
|
@@ -13,6 +14,18 @@ import type {
|
|
|
13
14
|
} from "./handlers"
|
|
14
15
|
import type { ActionParamsConfig, InferActionParams } from "./params"
|
|
15
16
|
|
|
17
|
+
// Validate fields structurally so JSON-shaped interfaces do not need an index signature.
|
|
18
|
+
// Builders infer the original result first, then check it without widening via NoInfer.
|
|
19
|
+
type WritebackJsonValue<T> = T extends ReadonlyJsonValue
|
|
20
|
+
? T
|
|
21
|
+
: T extends (...args: never[]) => unknown
|
|
22
|
+
? never
|
|
23
|
+
: T extends object
|
|
24
|
+
? { [K in keyof T]: WritebackJsonValue<T[K]> }
|
|
25
|
+
: never
|
|
26
|
+
|
|
27
|
+
type WritebackResult<T> = T extends ReturnType<() => void> ? T : WritebackJsonValue<T>
|
|
28
|
+
|
|
16
29
|
export interface BaseActionDefinition<
|
|
17
30
|
TId extends string = string,
|
|
18
31
|
TParams extends ActionParamsConfig = ActionParamsConfig,
|
|
@@ -136,7 +149,11 @@ export interface GlobalActionPhaseBuilder<TId extends string, TParams extends Ac
|
|
|
136
149
|
validator: GlobalActionValidator<InferActionParams<TParams>>
|
|
137
150
|
): GlobalActionPhaseBuilder<TId, TParams>
|
|
138
151
|
writeback<const TResult>(
|
|
139
|
-
handler: GlobalActionWritebackHandler<InferActionParams<TParams>, TResult>
|
|
152
|
+
handler: GlobalActionWritebackHandler<InferActionParams<TParams>, TResult> &
|
|
153
|
+
GlobalActionWritebackHandler<
|
|
154
|
+
InferActionParams<TParams>,
|
|
155
|
+
WritebackResult<NoInfer<Awaited<TResult>>>
|
|
156
|
+
>
|
|
140
157
|
): GlobalActionAfterWritebackBuilder<TId, TParams, TResult>
|
|
141
158
|
edits<const TResult extends ActionNoResultHandlerResult>(
|
|
142
159
|
handler: GlobalActionEditsHandler<InferActionParams<TParams>, undefined, TResult>
|
|
@@ -152,7 +169,12 @@ export interface ObjectActionPhaseBuilder<
|
|
|
152
169
|
validator: ActionValidator<TObjectType, InferActionParams<TParams>>
|
|
153
170
|
): ObjectActionPhaseBuilder<TId, TObjectType, TParams>
|
|
154
171
|
writeback<const TResult>(
|
|
155
|
-
handler: ActionWritebackHandler<TObjectType, InferActionParams<TParams>, TResult>
|
|
172
|
+
handler: ActionWritebackHandler<TObjectType, InferActionParams<TParams>, TResult> &
|
|
173
|
+
ActionWritebackHandler<
|
|
174
|
+
TObjectType,
|
|
175
|
+
InferActionParams<TParams>,
|
|
176
|
+
WritebackResult<NoInfer<Awaited<TResult>>>
|
|
177
|
+
>
|
|
156
178
|
): ObjectActionAfterWritebackBuilder<TId, TObjectType, TParams, TResult>
|
|
157
179
|
edits<const TResult extends ActionNoResultHandlerResult>(
|
|
158
180
|
handler: ActionEditsHandler<TObjectType, InferActionParams<TParams>, undefined, TResult>
|
package/src/agents/types.ts
CHANGED
|
@@ -45,6 +45,8 @@ export interface AgentLoopConfig {
|
|
|
45
45
|
readonly maxSteps?: number
|
|
46
46
|
}
|
|
47
47
|
readonly context?: AgentContextConfig
|
|
48
|
+
/** Automatic provider prompt caching. Defaults to `auto`; use `off` to opt out. */
|
|
49
|
+
readonly caching?: "auto" | "off"
|
|
48
50
|
}
|
|
49
51
|
|
|
50
52
|
type Simplify<T> = { [K in keyof T]: T[K] } & {}
|
package/src/agents/validation.ts
CHANGED
|
@@ -171,6 +171,9 @@ export function resolveAgentLoopConfig(
|
|
|
171
171
|
"[Sixb] Agent loop.stopWhen.maxSteps must be a positive safe integer."
|
|
172
172
|
)
|
|
173
173
|
}
|
|
174
|
+
if (loop.caching !== undefined && loop.caching !== "auto" && loop.caching !== "off") {
|
|
175
|
+
throw new AgentDefinitionError("[Sixb] Agent loop.caching must be 'auto' or 'off'.")
|
|
176
|
+
}
|
|
174
177
|
|
|
175
178
|
const context = loop.context ? snapshotAgentContextConfig(loop.context) : undefined
|
|
176
179
|
return Object.freeze({
|
|
@@ -178,6 +181,7 @@ export function resolveAgentLoopConfig(
|
|
|
178
181
|
? {}
|
|
179
182
|
: { stopWhen: Object.freeze({ ...(maxSteps === undefined ? {} : { maxSteps }) }) }),
|
|
180
183
|
...(context === undefined ? {} : { context }),
|
|
184
|
+
...(loop.caching === undefined ? {} : { caching: loop.caching }),
|
|
181
185
|
})
|
|
182
186
|
}
|
|
183
187
|
|
package/src/auth/index.ts
CHANGED
package/src/auth/runtime.ts
CHANGED
|
@@ -1242,6 +1242,7 @@ export class AuthRuntime {
|
|
|
1242
1242
|
audience: deliveryAudience,
|
|
1243
1243
|
returnTo: options.delivery?.returnTo ?? sanitizeReturnTo(input.returnTo),
|
|
1244
1244
|
requestOrigin: options.delivery?.requestOrigin ?? new URL(request.url).origin,
|
|
1245
|
+
revealLink: input.revealLink,
|
|
1245
1246
|
now,
|
|
1246
1247
|
})
|
|
1247
1248
|
} catch (error) {
|
|
@@ -1249,6 +1250,13 @@ export class AuthRuntime {
|
|
|
1249
1250
|
throw error
|
|
1250
1251
|
}
|
|
1251
1252
|
|
|
1253
|
+
// The runtime owns the disclosure boundary even for third-party strategies. A strategy that
|
|
1254
|
+
// accidentally returns a link must not expose it unless the caller opted in explicitly.
|
|
1255
|
+
delivery = {
|
|
1256
|
+
status: delivery.status,
|
|
1257
|
+
...(input.revealLink && delivery.link ? { link: delivery.link } : {}),
|
|
1258
|
+
}
|
|
1259
|
+
|
|
1252
1260
|
if (delivery.status === "not_supported") {
|
|
1253
1261
|
return { invitation, delivery }
|
|
1254
1262
|
}
|
package/src/auth/strategy.ts
CHANGED
package/src/auth/types.ts
CHANGED
|
@@ -73,6 +73,8 @@ export interface InvitationDeliveryInput {
|
|
|
73
73
|
readonly audience: AuthSessionAudience
|
|
74
74
|
readonly returnTo: string
|
|
75
75
|
readonly requestOrigin: string
|
|
76
|
+
/** Return the delivered link once so the inviter can copy it through an approved channel. */
|
|
77
|
+
readonly revealLink?: boolean
|
|
76
78
|
readonly now?: Date
|
|
77
79
|
}
|
|
78
80
|
|
|
@@ -80,8 +82,18 @@ export type AuthEmailDeliveryStatus = "sent" | "skipped" | "rate_limited"
|
|
|
80
82
|
|
|
81
83
|
export type InviteDeliveryStatus = AuthEmailDeliveryStatus | "not_supported"
|
|
82
84
|
|
|
85
|
+
export interface RevealedInvitationLink {
|
|
86
|
+
readonly url: string
|
|
87
|
+
readonly expiresAt?: Date
|
|
88
|
+
}
|
|
89
|
+
|
|
83
90
|
export interface InviteDeliveryResult {
|
|
84
91
|
readonly status: InviteDeliveryStatus
|
|
92
|
+
/**
|
|
93
|
+
* Present only when the caller explicitly requests `revealLink`. Treat this as a credential:
|
|
94
|
+
* never persist it or include it in list responses, logs, or analytics.
|
|
95
|
+
*/
|
|
96
|
+
readonly link?: RevealedInvitationLink
|
|
85
97
|
}
|
|
86
98
|
|
|
87
99
|
export interface InvitationDeliveryAuthStrategy extends AuthStrategy {
|
|
@@ -214,6 +226,8 @@ export interface InviteUserInput {
|
|
|
214
226
|
readonly groupIds?: readonly string[]
|
|
215
227
|
readonly expiresAt?: Date
|
|
216
228
|
readonly returnTo?: string
|
|
229
|
+
/** Reveal the delivered link once in the result. Defaults to false. */
|
|
230
|
+
readonly revealLink?: boolean
|
|
217
231
|
}
|
|
218
232
|
|
|
219
233
|
export interface InviteUserResult {
|
package/src/index.ts
CHANGED
|
@@ -77,7 +77,12 @@ export type {
|
|
|
77
77
|
ActionRuntimeFacade,
|
|
78
78
|
ActionSubject,
|
|
79
79
|
ActionTargetObject,
|
|
80
|
+
ActionTelemetryHistoryBatchInput,
|
|
81
|
+
ActionTelemetryHistoryBatchResult,
|
|
82
|
+
ActionTelemetryHistorySeriesInput,
|
|
80
83
|
ActionTelemetryObjectSet,
|
|
84
|
+
ActionTelemetryPropertyToken,
|
|
85
|
+
ActionTelemetryReadFacade,
|
|
81
86
|
ActionValidationContext,
|
|
82
87
|
ActionValidator,
|
|
83
88
|
ActionWritebackContext,
|
package/src/ontology/internal.ts
CHANGED
|
@@ -4,20 +4,42 @@ import type { Schema, ValueType } from "./types"
|
|
|
4
4
|
|
|
5
5
|
export type SchemaJsonSchema = Readonly<Record<string, unknown>>
|
|
6
6
|
|
|
7
|
+
export interface SchemaJsonField {
|
|
8
|
+
readonly schema: SchemaOrRef
|
|
9
|
+
readonly required?: boolean
|
|
10
|
+
readonly nullable?: boolean
|
|
11
|
+
}
|
|
12
|
+
|
|
7
13
|
/** Convert a record of Sixb schemas into the strict JSON object schema used by model outputs. */
|
|
8
14
|
export function schemaRecordToJsonSchema(input: {
|
|
9
15
|
readonly shape: Readonly<Record<string, SchemaOrRef>>
|
|
10
16
|
readonly valueTypesById: ReadonlyMap<string, ValueType>
|
|
11
17
|
}): SchemaJsonSchema {
|
|
18
|
+
return schemaFieldsToJsonSchema({
|
|
19
|
+
fields: Object.fromEntries(
|
|
20
|
+
Object.entries(input.shape).map(([field, schema]) => [field, { schema, required: true }])
|
|
21
|
+
),
|
|
22
|
+
valueTypesById: input.valueTypesById,
|
|
23
|
+
})
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** Convert configured fields into the strict JSON object schema accepted at runtime. */
|
|
27
|
+
export function schemaFieldsToJsonSchema(input: {
|
|
28
|
+
readonly fields: Readonly<Record<string, SchemaJsonField>>
|
|
29
|
+
readonly valueTypesById: ReadonlyMap<string, ValueType>
|
|
30
|
+
}): SchemaJsonSchema {
|
|
31
|
+
const required = Object.entries(input.fields)
|
|
32
|
+
.filter(([, field]) => field.required === true)
|
|
33
|
+
.map(([field]) => field)
|
|
12
34
|
return {
|
|
13
35
|
type: "object",
|
|
14
36
|
properties: Object.fromEntries(
|
|
15
|
-
Object.entries(input.
|
|
16
|
-
field,
|
|
17
|
-
|
|
18
|
-
|
|
37
|
+
Object.entries(input.fields).map(([fieldId, field]) => {
|
|
38
|
+
const fieldSchema = schemaOrRefJsonSchema(field.schema, input.valueTypesById, new Set())
|
|
39
|
+
return [fieldId, field.nullable ? { anyOf: [fieldSchema, { type: "null" }] } : fieldSchema]
|
|
40
|
+
})
|
|
19
41
|
),
|
|
20
|
-
required:
|
|
42
|
+
...(required.length > 0 ? { required } : {}),
|
|
21
43
|
additionalProperties: false,
|
|
22
44
|
}
|
|
23
45
|
}
|
package/src/storage/index.ts
CHANGED
|
@@ -422,6 +422,7 @@ export type {
|
|
|
422
422
|
MaterializationClassificationWorkRecord,
|
|
423
423
|
MaterializationEventWorkRecord,
|
|
424
424
|
MaterializationIncidentObjectWorkRecord,
|
|
425
|
+
MaterializationLinkScopeRevision,
|
|
425
426
|
MaterializationLinkScopeState,
|
|
426
427
|
MaterializationLinkState,
|
|
427
428
|
MaterializationObjectExistence,
|