@inventarch/agent-composition-system 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LANGUAGE.md +2 -2
- package/README.md +3 -1
- package/SPEC.md +3 -1
- package/dist/adapters.d.ts +2 -69
- package/dist/adapters.d.ts.map +1 -1
- package/dist/adapters.js +2 -211
- package/dist/adapters.js.map +1 -1
- package/dist/authoring-format.d.ts +2 -22
- package/dist/authoring-format.d.ts.map +1 -1
- package/dist/authoring-format.js +2 -287
- package/dist/authoring-format.js.map +1 -1
- package/dist/authoring-index.d.ts +2 -31
- package/dist/authoring-index.d.ts.map +1 -1
- package/dist/authoring-index.js +2 -251
- package/dist/authoring-index.js.map +1 -1
- package/dist/authoring-manifest.d.ts +2 -68
- package/dist/authoring-manifest.d.ts.map +1 -1
- package/dist/authoring-manifest.js +2 -386
- package/dist/authoring-manifest.js.map +1 -1
- package/dist/authoring-types.d.ts +2 -224
- package/dist/authoring-types.d.ts.map +1 -1
- package/dist/authoring-types.js +2 -1
- package/dist/authoring-types.js.map +1 -1
- package/dist/authoring.d.ts +2 -46
- package/dist/authoring.d.ts.map +1 -1
- package/dist/authoring.js +2 -564
- package/dist/authoring.js.map +1 -1
- package/dist/candidate.d.ts +2 -10
- package/dist/candidate.d.ts.map +1 -1
- package/dist/candidate.js +2 -83
- package/dist/candidate.js.map +1 -1
- package/dist/compile.d.ts +1 -1
- package/dist/compile.d.ts.map +1 -1
- package/dist/compile.js +8 -4
- package/dist/compile.js.map +1 -1
- package/dist/corpus.d.ts +2 -32
- package/dist/corpus.d.ts.map +1 -1
- package/dist/corpus.js +2 -181
- package/dist/corpus.js.map +1 -1
- package/dist/index.d.ts +9 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -3
- package/dist/index.js.map +1 -1
- package/dist/installed-catalog.d.ts +2 -2
- package/dist/installed-catalog.d.ts.map +1 -1
- package/dist/installed-catalog.js +4 -45
- package/dist/installed-catalog.js.map +1 -1
- package/dist/installed-read.d.ts +1 -1
- package/dist/installed-read.d.ts.map +1 -1
- package/dist/installed-read.js +1 -1
- package/dist/installed-read.js.map +1 -1
- package/dist/installed-source-policy.d.ts +2 -30
- package/dist/installed-source-policy.d.ts.map +1 -1
- package/dist/installed-source-policy.js +2 -94
- package/dist/installed-source-policy.js.map +1 -1
- package/dist/lifecycle-profile.d.ts +2 -58
- package/dist/lifecycle-profile.d.ts.map +1 -1
- package/dist/lifecycle-profile.js +2 -205
- package/dist/lifecycle-profile.js.map +1 -1
- package/dist/lifecycle-rows.d.ts +2 -11
- package/dist/lifecycle-rows.d.ts.map +1 -1
- package/dist/lifecycle-rows.js +2 -34
- package/dist/lifecycle-rows.js.map +1 -1
- package/dist/lifecycle-transport.d.ts +2 -20
- package/dist/lifecycle-transport.d.ts.map +1 -1
- package/dist/lifecycle-transport.js +2 -126
- package/dist/lifecycle-transport.js.map +1 -1
- package/dist/lifecycle.d.ts +2 -121
- package/dist/lifecycle.d.ts.map +1 -1
- package/dist/lifecycle.js +2 -436
- package/dist/lifecycle.js.map +1 -1
- package/dist/local-store.d.ts +2 -49
- package/dist/local-store.d.ts.map +1 -1
- package/dist/local-store.js +2 -185
- package/dist/local-store.js.map +1 -1
- package/dist/native-selection.json +55 -55
- package/dist/native.ia.tgz +0 -0
- package/dist/projection-codex.d.ts +2 -14
- package/dist/projection-codex.d.ts.map +1 -1
- package/dist/projection-codex.js +2 -73
- package/dist/projection-codex.js.map +1 -1
- package/dist/projection-format.d.ts +2 -152
- package/dist/projection-format.d.ts.map +1 -1
- package/dist/projection-format.js +2 -200
- package/dist/projection-format.js.map +1 -1
- package/dist/projection-host.d.ts +2 -42
- package/dist/projection-host.d.ts.map +1 -1
- package/dist/projection-host.js +2 -338
- package/dist/projection-host.js.map +1 -1
- package/dist/projection-routine.d.ts +2 -3
- package/dist/projection-routine.d.ts.map +1 -1
- package/dist/projection-routine.js +2 -49
- package/dist/projection-routine.js.map +1 -1
- package/dist/projections.d.ts +2 -23
- package/dist/projections.d.ts.map +1 -1
- package/dist/projections.js +2 -430
- package/dist/projections.js.map +1 -1
- package/dist/publication.d.ts +2 -6
- package/dist/publication.d.ts.map +1 -1
- package/dist/publication.js +2 -139
- package/dist/publication.js.map +1 -1
- package/dist/resource-context.d.ts +2 -25
- package/dist/resource-context.d.ts.map +1 -1
- package/dist/resource-context.js +2 -270
- package/dist/resource-context.js.map +1 -1
- package/dist/resource-files.d.ts +2 -9
- package/dist/resource-files.d.ts.map +1 -1
- package/dist/resource-files.js +2 -87
- package/dist/resource-files.js.map +1 -1
- package/dist/resource-format.d.ts +2 -105
- package/dist/resource-format.d.ts.map +1 -1
- package/dist/resource-format.js +2 -241
- package/dist/resource-format.js.map +1 -1
- package/dist/resource-sources.d.ts +2 -6
- package/dist/resource-sources.d.ts.map +1 -1
- package/dist/resource-sources.js +2 -15
- package/dist/resource-sources.js.map +1 -1
- package/dist/resources.d.ts +2 -23
- package/dist/resources.d.ts.map +1 -1
- package/dist/resources.js +2 -82
- package/dist/resources.js.map +1 -1
- package/dist/sources.d.ts +2 -44
- package/dist/sources.d.ts.map +1 -1
- package/dist/sources.js +2 -289
- package/dist/sources.js.map +1 -1
- package/dist/system-package.json +313 -312
- package/dist/task-capture-format.d.ts +2 -24
- package/dist/task-capture-format.d.ts.map +1 -1
- package/dist/task-capture-format.js +2 -61
- package/dist/task-capture-format.js.map +1 -1
- package/dist/task-capture.d.ts +7 -7
- package/dist/task-capture.d.ts.map +1 -1
- package/dist/task-capture.js +8 -8
- package/dist/task-capture.js.map +1 -1
- package/dist/task-context-declaration.d.ts +2 -2
- package/dist/task-context-declaration.d.ts.map +1 -1
- package/dist/task-context-declaration.js +2 -2
- package/dist/task-context-declaration.js.map +1 -1
- package/dist/task-teaching-closure.d.ts +3 -3
- package/dist/task-teaching-closure.d.ts.map +1 -1
- package/dist/task-teaching-closure.js +4 -4
- package/dist/task-teaching-closure.js.map +1 -1
- package/dist/templates.d.ts +2 -34
- package/dist/templates.d.ts.map +1 -1
- package/dist/templates.js +2 -109
- package/dist/templates.js.map +1 -1
- package/dist/tools.d.ts +2 -2
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +3 -3
- package/dist/tools.js.map +1 -1
- package/package.json +13 -12
- package/references/public-spec.md +1 -1
package/dist/index.js
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
/** @deprecated Import from @inventarch/workspace-runtime. */
|
|
2
|
+
export { captureWorkspace, adoptWorkspace, verifyCapture, Corpus } from '@inventarch/workspace-runtime';
|
|
2
3
|
export { compileHarness } from './compile.js';
|
|
3
4
|
export { executionManifest } from './execution.js';
|
|
4
|
-
|
|
5
|
-
export {
|
|
5
|
+
/** @deprecated Import from @inventarch/workspace-runtime. */
|
|
6
|
+
export { candidateValidation } from '@inventarch/workspace-runtime';
|
|
7
|
+
/** @deprecated Import from @inventarch/workspace-runtime. */
|
|
8
|
+
export { managedPublication } from '@inventarch/workspace-runtime';
|
|
9
|
+
/** The workspace-runtime pin plus this package's own installed bytes; not the bare @inventarch/workspace-runtime export. */
|
|
6
10
|
export { installedImplementationDigest } from './installed-catalog.js';
|
|
7
11
|
export { installed } from './catalog.js';
|
|
8
12
|
export { INSTALLED_READ, installedReadCatalog, installedReadAdapters } from './installed-read.js';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,6DAA6D;AAC7D,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AAGxG,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,6DAA6D;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,6DAA6D;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,4HAA4H;AAC5H,OAAO,EAAE,6BAA6B,EAAE,MAAM,wBAAwB,CAAC;AAEvE,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAYzC,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAElG,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAWjD,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,mBAAmB,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
1
|
+
/** The generic workspace-runtime pin plus this package's own installed entrypoint, so the composition compiler and its
|
|
2
|
+
* adapters stay pinned. Never a record- or model-supplied path. */
|
|
3
3
|
export declare function installedImplementationDigest(): string;
|
|
4
4
|
//# sourceMappingURL=installed-catalog.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"installed-catalog.d.ts","sourceRoot":"","sources":["../src/installed-catalog.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"installed-catalog.d.ts","sourceRoot":"","sources":["../src/installed-catalog.ts"],"names":[],"mappings":"AAGA;mEACmE;AACnE,wBAAgB,6BAA6B,IAAI,MAAM,CAEtD"}
|
|
@@ -1,49 +1,8 @@
|
|
|
1
|
-
import { createHash } from 'node:crypto';
|
|
2
|
-
import { readdirSync, readFileSync } from 'node:fs';
|
|
3
|
-
import { dirname, resolve, relative } from 'node:path';
|
|
4
1
|
import { fileURLToPath } from 'node:url';
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
/** Node host helper over fixed installed package entrypoints, never record- or model-supplied paths.
|
|
9
|
-
* Bundled hosts supply their verified release artifact digest to inspectionCatalog instead. */
|
|
2
|
+
import { installedImplementationDigest as workspaceRuntimeImplementationDigest } from '@inventarch/workspace-runtime/installed-catalog';
|
|
3
|
+
/** The generic workspace-runtime pin plus this package's own installed entrypoint, so the composition compiler and its
|
|
4
|
+
* adapters stay pinned. Never a record- or model-supplied path. */
|
|
10
5
|
export function installedImplementationDigest() {
|
|
11
|
-
|
|
12
|
-
const entries = [
|
|
13
|
-
['agent-composition-system', fileURLToPath(import.meta.url)],
|
|
14
|
-
['agent-system', fileURLToPath(import.meta.resolve('@inventarch/agent-system'))],
|
|
15
|
-
['session-system', fileURLToPath(import.meta.resolve('@inventarch/session-system'))],
|
|
16
|
-
['template-system', fileURLToPath(import.meta.resolve('@inventarch/template-system'))],
|
|
17
|
-
['authoring-system', fileURLToPath(import.meta.resolve('@inventarch/authoring-system'))],
|
|
18
|
-
['runtime', fileURLToPath(import.meta.resolve('@inventarch/runtime'))],
|
|
19
|
-
['db', fileURLToPath(database)],
|
|
20
|
-
['graph', fileURLToPath(import.meta.resolve('@inventarch/graph'))],
|
|
21
|
-
['language', fileURLToPath(import.meta.resolve('@inventarch/language'))],
|
|
22
|
-
['compliance', createRequire(database).resolve('@inventarch/compliance')],
|
|
23
|
-
];
|
|
24
|
-
const files = [];
|
|
25
|
-
for (const [name, entry] of entries) {
|
|
26
|
-
const root = dirname(entry);
|
|
27
|
-
const visit = (directory) => {
|
|
28
|
-
for (const child of readdirSync(directory, { withFileTypes: true })) {
|
|
29
|
-
if (child.isSymbolicLink())
|
|
30
|
-
throw new Error('Installed code aliases are unsupported');
|
|
31
|
-
const path = resolve(directory, child.name);
|
|
32
|
-
if (child.isDirectory())
|
|
33
|
-
visit(path);
|
|
34
|
-
else if (/\.(?:[cm]?js|ts)$/.test(child.name) &&
|
|
35
|
-
!child.name.endsWith('.d.ts') &&
|
|
36
|
-
!(child.isFile() && platformDebris(child.name)))
|
|
37
|
-
files.push({
|
|
38
|
-
package: name,
|
|
39
|
-
path: relative(root, path).replaceAll('\\', '/'),
|
|
40
|
-
digest: createHash('sha256').update(readFileSync(path)).digest('hex'),
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
visit(root);
|
|
45
|
-
}
|
|
46
|
-
files.sort((a, b) => (`${a.package}/${a.path}` < `${b.package}/${b.path}` ? -1 : 1));
|
|
47
|
-
return digest(files);
|
|
6
|
+
return workspaceRuntimeImplementationDigest([['agent-composition-system', fileURLToPath(import.meta.url)]]);
|
|
48
7
|
}
|
|
49
8
|
//# sourceMappingURL=installed-catalog.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"installed-catalog.js","sourceRoot":"","sources":["../src/installed-catalog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"installed-catalog.js","sourceRoot":"","sources":["../src/installed-catalog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,6BAA6B,IAAI,oCAAoC,EAAE,MAAM,iDAAiD,CAAC;AAExI;mEACmE;AACnE,MAAM,UAAU,6BAA6B;IAC3C,OAAO,oCAAoC,CAAC,CAAC,CAAC,0BAA0B,EAAE,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AAC9G,CAAC"}
|
package/dist/installed-read.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Manifest, OperationAdapter } from '@inventarch/agent-system';
|
|
2
2
|
import type { CompositionCatalog } from './catalog.js';
|
|
3
3
|
import type { CompiledHarness } from './compiled.js';
|
|
4
|
-
import type { Capture } from '
|
|
4
|
+
import type { Capture } from '@inventarch/workspace-runtime/corpus';
|
|
5
5
|
/** Fixed first-party identities. Native/model inputs never select a module or handler. */
|
|
6
6
|
export declare const INSTALLED_READ: Readonly<{
|
|
7
7
|
operation: "authoring-system/binding/operation/read-captured-source";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"installed-read.d.ts","sourceRoot":"","sources":["../src/installed-read.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,gBAAgB,EAAoB,MAAM,0BAA0B,CAAC;AAI7F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAGrD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"installed-read.d.ts","sourceRoot":"","sources":["../src/installed-read.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,gBAAgB,EAAoB,MAAM,0BAA0B,CAAC;AAI7F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAGrD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sCAAsC,CAAC;AAIpE,0FAA0F;AAC1F,eAAO,MAAM,cAAc;;;;;;EAMzB,CAAC;AACH,MAAM,MAAM,oBAAoB,GAAG,IAAI,CAAC,kBAAkB,EAAE,YAAY,GAAG,YAAY,CAAC,CAAC;AAsBzF,6FAA6F;AAC7F,wBAAgB,oBAAoB,IAAI,oBAAoB,CAsB3D;AACD,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,QAAQ,CAAC,QAAQ,EAAE,eAAe,CAAC;IACnC,QAAQ,CAAC,OAAO,EAAE,kBAAkB,CAAC;IACrC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,mGAAmG;IACnG,QAAQ,CAAC,cAAc,EAAE,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CAC3D;AAKD,oGAAoG;AACpG,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,OAAO,EACd,OAAO,EAAE,oBAAoB,GAC5B;IAAE,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC,CAAC;IAAC,KAAK,IAAI,IAAI,CAAA;CAAE,CA+G3E"}
|
package/dist/installed-read.js
CHANGED
|
@@ -2,7 +2,7 @@ import { manifestDigest, validateShape } from '@inventarch/agent-system';
|
|
|
2
2
|
import { canonical, copy, digest, SessionError } from '@inventarch/session-system';
|
|
3
3
|
import { installed } from './catalog.js';
|
|
4
4
|
import { compileHarness } from './compile.js';
|
|
5
|
-
import { Corpus, verifyCapture } from '
|
|
5
|
+
import { Corpus, verifyCapture } from '@inventarch/workspace-runtime/corpus';
|
|
6
6
|
import { executionManifest } from './execution.js';
|
|
7
7
|
import { installedImplementationDigest } from './installed-catalog.js';
|
|
8
8
|
/** Fixed first-party identities. Native/model inputs never select a module or handler. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"installed-read.js","sourceRoot":"","sources":["../src/installed-read.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEzE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAEnF,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAGzC,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"installed-read.js","sourceRoot":"","sources":["../src/installed-read.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEzE,OAAO,EAAE,SAAS,EAAE,I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CAAC;QACjB,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,31 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export interface SourceInstallation {
|
|
4
|
-
readonly pointer: ActivationPointer;
|
|
5
|
-
readonly lock: DistributionLock;
|
|
6
|
-
readonly inputs: GenerationInputs;
|
|
7
|
-
readonly bundles: ReadonlyMap<string, ExpandedBundle>;
|
|
8
|
-
}
|
|
9
|
-
export interface RetainedSourceInstallation {
|
|
10
|
-
readonly pointer: ActivationPointer;
|
|
11
|
-
readonly lock: DistributionLock;
|
|
12
|
-
readonly inputs: GenerationInputs;
|
|
13
|
-
readonly bundles: readonly {
|
|
14
|
-
readonly id: string;
|
|
15
|
-
readonly manifest: BundleManifest;
|
|
16
|
-
readonly archiveDigest: string;
|
|
17
|
-
readonly manifestDigest: string;
|
|
18
|
-
readonly files: readonly {
|
|
19
|
-
readonly path: string;
|
|
20
|
-
readonly base64: string;
|
|
21
|
-
}[];
|
|
22
|
-
}[];
|
|
23
|
-
}
|
|
24
|
-
export declare const SOURCE_INSTALLATION_BYTES: number;
|
|
25
|
-
/** Decode retained data, then delegate all native membership and payload verification to the native owner. */
|
|
26
|
-
export declare function readSourceInstallation(value: unknown): SourceInstallation & {
|
|
27
|
-
readonly sources: Capture['sources'];
|
|
28
|
-
};
|
|
29
|
-
/** Synchronous copy occurs before callers can mutate file buffers, maps, metadata or activation. */
|
|
30
|
-
export declare function retainSourceInstallation(value: SourceInstallation): RetainedSourceInstallation;
|
|
1
|
+
/** @deprecated Import from @inventarch/workspace-runtime/internal/installed-source-policy. */
|
|
2
|
+
export * from '@inventarch/workspace-runtime/internal/installed-source-policy';
|
|
31
3
|
//# sourceMappingURL=installed-source-policy.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"installed-source-policy.d.ts","sourceRoot":"","sources":["../src/installed-source-policy.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"installed-source-policy.d.ts","sourceRoot":"","sources":["../src/installed-source-policy.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,cAAc,gEAAgE,CAAC"}
|
|
@@ -1,95 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
// This hosted retained-policy profile is narrower than the native 256 MiB expanded archive limit.
|
|
4
|
-
export const SOURCE_INSTALLATION_BYTES = 32 * 1024 * 1024;
|
|
5
|
-
function fail() {
|
|
6
|
-
throw new Error('Invalid retained source installation');
|
|
7
|
-
}
|
|
8
|
-
function object(value, keys) {
|
|
9
|
-
if (!value || typeof value !== 'object' || ![Object.prototype, null].includes(Object.getPrototypeOf(value)))
|
|
10
|
-
fail();
|
|
11
|
-
const names = Reflect.ownKeys(value), descriptors = Object.getOwnPropertyDescriptors(value);
|
|
12
|
-
if (names.length !== keys.length ||
|
|
13
|
-
names.some((key) => typeof key !== 'string' ||
|
|
14
|
-
!keys.includes(key) ||
|
|
15
|
-
!descriptors[key]?.enumerable ||
|
|
16
|
-
!Object.hasOwn(descriptors[key], 'value')))
|
|
17
|
-
fail();
|
|
18
|
-
return value;
|
|
19
|
-
}
|
|
20
|
-
function array(value, max) {
|
|
21
|
-
if (!Array.isArray(value) ||
|
|
22
|
-
value.length > max ||
|
|
23
|
-
Reflect.ownKeys(value).length !== value.length + 1 ||
|
|
24
|
-
Object.values(Object.getOwnPropertyDescriptors(value)).some((row) => !Object.hasOwn(row, 'value')))
|
|
25
|
-
fail();
|
|
26
|
-
return value;
|
|
27
|
-
}
|
|
28
|
-
const hash = (value) => (typeof value === 'string' && /^[a-f0-9]{64}$/.test(value) ? value : fail());
|
|
29
|
-
/** Decode retained data, then delegate all native membership and payload verification to the native owner. */
|
|
30
|
-
export function readSourceInstallation(value) {
|
|
31
|
-
const row = object(value, ['pointer', 'lock', 'inputs', 'bundles']);
|
|
32
|
-
const pointer = decodeActivationPointer(row['pointer']), lock = decodeDistributionLock(row['lock']), inputs = decodeGenerationInputs(row['inputs']);
|
|
33
|
-
if (!satisfies(DISTRIBUTION_ENGINE_VERSION, lock.engine))
|
|
34
|
-
fail();
|
|
35
|
-
const bundles = new Map();
|
|
36
|
-
let total = 0, count = 0, previous = '';
|
|
37
|
-
for (const entry of array(row['bundles'], DISTRIBUTION_LIMITS.bundles)) {
|
|
38
|
-
const bundle = object(entry, ['id', 'manifest', 'archiveDigest', 'manifestDigest', 'files']);
|
|
39
|
-
const manifest = decodeBundleManifest(bundle['manifest']), id = bundle['id'];
|
|
40
|
-
if (id !== manifest.id || id <= previous)
|
|
41
|
-
fail();
|
|
42
|
-
previous = id;
|
|
43
|
-
const files = new Map();
|
|
44
|
-
let pathBefore = '';
|
|
45
|
-
for (const item of array(bundle['files'], DISTRIBUTION_LIMITS.files)) {
|
|
46
|
-
const file = object(item, ['path', 'base64']), path = file['path'], base64 = file['base64'];
|
|
47
|
-
if (++count > DISTRIBUTION_LIMITS.files ||
|
|
48
|
-
typeof path !== 'string' ||
|
|
49
|
-
path <= pathBefore ||
|
|
50
|
-
typeof base64 !== 'string' ||
|
|
51
|
-
base64.length > Math.ceil(DISTRIBUTION_LIMITS.file / 3) * 4)
|
|
52
|
-
fail();
|
|
53
|
-
const pin = manifest.files.find((pin) => pin.path === path);
|
|
54
|
-
if (!pin || (total += pin.bytes) > SOURCE_INSTALLATION_BYTES || base64.length !== Math.ceil(pin.bytes / 3) * 4)
|
|
55
|
-
fail();
|
|
56
|
-
const bytes = Buffer.from(base64, 'base64');
|
|
57
|
-
if (bytes.toString('base64') !== base64 || bytes.length !== pin.bytes)
|
|
58
|
-
fail();
|
|
59
|
-
files.set(path, bytes);
|
|
60
|
-
pathBefore = path;
|
|
61
|
-
}
|
|
62
|
-
bundles.set(id, {
|
|
63
|
-
manifest,
|
|
64
|
-
archiveDigest: hash(bundle['archiveDigest']),
|
|
65
|
-
manifestDigest: hash(bundle['manifestDigest']),
|
|
66
|
-
files,
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
if (bundles.size !== lock.packages.length || lock.packages.some((pkg) => !bundles.has(pkg.id)))
|
|
70
|
-
fail();
|
|
71
|
-
return { pointer, lock, inputs, bundles, sources: generationSources(pointer, lock, inputs, bundles) };
|
|
72
|
-
}
|
|
73
|
-
/** Synchronous copy occurs before callers can mutate file buffers, maps, metadata or activation. */
|
|
74
|
-
export function retainSourceInstallation(value) {
|
|
75
|
-
const data = {
|
|
76
|
-
pointer: value.pointer,
|
|
77
|
-
lock: value.lock,
|
|
78
|
-
inputs: value.inputs,
|
|
79
|
-
bundles: [...value.bundles]
|
|
80
|
-
.sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0))
|
|
81
|
-
.map(([id, bundle]) => ({
|
|
82
|
-
id,
|
|
83
|
-
manifest: bundle.manifest,
|
|
84
|
-
archiveDigest: bundle.archiveDigest,
|
|
85
|
-
manifestDigest: bundle.manifestDigest,
|
|
86
|
-
files: [...bundle.files]
|
|
87
|
-
.sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0))
|
|
88
|
-
.map(([path, bytes]) => ({ path, base64: bytes.toString('base64') })),
|
|
89
|
-
})),
|
|
90
|
-
};
|
|
91
|
-
readSourceInstallation(data);
|
|
92
|
-
// Native metadata decoders return closed detached values; JSON detaches the complete retained envelope.
|
|
93
|
-
return copy(data);
|
|
94
|
-
}
|
|
1
|
+
/** @deprecated Import from @inventarch/workspace-runtime/internal/installed-source-policy. */
|
|
2
|
+
export * from '@inventarch/workspace-runtime/internal/installed-source-policy';
|
|
95
3
|
//# sourceMappingURL=installed-source-policy.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"installed-source-policy.js","sourceRoot":"","sources":["../src/installed-source-policy.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"installed-source-policy.js","sourceRoot":"","sources":["../src/installed-source-policy.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,cAAc,gEAAgE,CAAC"}
|
|
@@ -1,59 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
constructor(code: string, message: string);
|
|
4
|
-
}
|
|
5
|
-
export interface LifecycleProfile {
|
|
6
|
-
readonly format: 'ia.lifecycle-profile.v1';
|
|
7
|
-
readonly host: string;
|
|
8
|
-
readonly version: string;
|
|
9
|
-
readonly available: boolean;
|
|
10
|
-
readonly reason: string | null;
|
|
11
|
-
readonly events: readonly string[];
|
|
12
|
-
readonly maxContextCharacters: number | null;
|
|
13
|
-
readonly maxContextParts: number;
|
|
14
|
-
readonly maxInputBytes: number;
|
|
15
|
-
readonly maxPromptBytes: number;
|
|
16
|
-
readonly digest: string;
|
|
17
|
-
/** The row's closed UserPromptSubmit fields, digested with the body; absent on unavailable profiles and the two unfolded rows. */
|
|
18
|
-
readonly promptFields?: readonly string[];
|
|
19
|
-
}
|
|
20
|
-
export interface LifecycleEvent {
|
|
21
|
-
readonly format: 'ia.lifecycle-event.v1';
|
|
22
|
-
readonly profile: string;
|
|
23
|
-
readonly host: string;
|
|
24
|
-
readonly kind: 'start' | 'prompt' | 'native';
|
|
25
|
-
readonly source: 'startup' | 'resume' | 'clear' | 'compact' | 'fork' | null;
|
|
26
|
-
readonly session: string;
|
|
27
|
-
readonly agent: string | null;
|
|
28
|
-
readonly cwd: string;
|
|
29
|
-
readonly promptId: string | null;
|
|
30
|
-
readonly prompt: string | null;
|
|
31
|
-
/** Retriable host event identity, if the host supplies one. Never a delivery acknowledgement. */
|
|
32
|
-
readonly key: string | null;
|
|
33
|
-
readonly inputDigest: string;
|
|
34
|
-
readonly delivery: 'unconfirmed';
|
|
35
|
-
}
|
|
36
|
-
/** The exact Claude Code version, not a range, whose row new context registrations select. */
|
|
37
|
-
export declare const SELECTED_CLAUDE_CODE_VERSION = "2.1.285";
|
|
38
|
-
/** A compatibility declaration, not an observation that a host enabled or delivered hooks. */
|
|
39
|
-
export declare function lifecycleProfile(host: string, version: string): LifecycleProfile;
|
|
40
|
-
export declare function verifyLifecycleProfile(input: LifecycleProfile): LifecycleProfile;
|
|
41
|
-
/** The host and version of one available segmented row. */
|
|
42
|
-
export interface SegmentedLifecycleRow {
|
|
43
|
-
readonly host: string;
|
|
44
|
-
readonly version: string;
|
|
45
|
-
}
|
|
46
|
-
/** The available segmented row this exact digest names, or null; no version range is inferred. */
|
|
47
|
-
export declare function segmentedLifecycleRow(digest: unknown): SegmentedLifecycleRow | null;
|
|
48
|
-
/** True only for the digest of an available segmented Claude Code row; no version range is inferred. */
|
|
49
|
-
export declare function isSegmentedLifecycleProfile(digest: unknown): boolean;
|
|
50
|
-
/** Decode bounded host metadata only. No transcript, path, module or credential is opened. */
|
|
51
|
-
export declare function decodeLifecycleEvent(inputProfile: LifecycleProfile, input: string): LifecycleEvent;
|
|
52
|
-
/** Authenticated native hosts supply their own retained session/profile/attempt, never a coding-host transcript. */
|
|
53
|
-
export declare function createNativeLifecycleEvent(input: {
|
|
54
|
-
readonly session: string;
|
|
55
|
-
readonly profile: string;
|
|
56
|
-
readonly invocation: string | null;
|
|
57
|
-
readonly text: string;
|
|
58
|
-
}): LifecycleEvent;
|
|
1
|
+
/** @deprecated Import from @inventarch/workspace-runtime/lifecycle-profile. */
|
|
2
|
+
export * from '@inventarch/workspace-runtime/lifecycle-profile';
|
|
59
3
|
//# sourceMappingURL=lifecycle-profile.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lifecycle-profile.d.ts","sourceRoot":"","sources":["../src/lifecycle-profile.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"lifecycle-profile.d.ts","sourceRoot":"","sources":["../src/lifecycle-profile.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,cAAc,iDAAiD,CAAC"}
|
|
@@ -1,206 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { claudeCodeRows, profileFromRows } from './lifecycle-rows.js';
|
|
4
|
-
export class LifecycleError extends Error {
|
|
5
|
-
code;
|
|
6
|
-
constructor(code, message) {
|
|
7
|
-
super(message);
|
|
8
|
-
this.code = code;
|
|
9
|
-
this.name = 'LifecycleError';
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
function fail(message) {
|
|
13
|
-
throw new LifecycleError('IA-LIFECYCLE-INPUT', message);
|
|
14
|
-
}
|
|
15
|
-
function string(value, max = 4096, empty = false) {
|
|
16
|
-
if (typeof value !== 'string' ||
|
|
17
|
-
(!empty && !value) ||
|
|
18
|
-
Buffer.byteLength(value) > max ||
|
|
19
|
-
Buffer.from(value).toString('utf8') !== value ||
|
|
20
|
-
/\u0000/.test(value))
|
|
21
|
-
fail('Invalid or oversized lifecycle text');
|
|
22
|
-
return value;
|
|
23
|
-
}
|
|
24
|
-
function object(value, allowed) {
|
|
25
|
-
if (value === null ||
|
|
26
|
-
typeof value !== 'object' ||
|
|
27
|
-
Array.isArray(value) ||
|
|
28
|
-
![null, Object.prototype].includes(Object.getPrototypeOf(value)))
|
|
29
|
-
fail('Expected lifecycle object');
|
|
30
|
-
const descriptors = Object.getOwnPropertyDescriptors(value);
|
|
31
|
-
if (Reflect.ownKeys(value).some((key) => typeof key !== 'string' ||
|
|
32
|
-
!allowed.includes(key) ||
|
|
33
|
-
!descriptors[key]?.enumerable ||
|
|
34
|
-
!Object.hasOwn(descriptors[key], 'value')))
|
|
35
|
-
fail('Unknown or non-data lifecycle field');
|
|
36
|
-
return value;
|
|
37
|
-
}
|
|
38
|
-
/** The exact Claude Code version, not a range, whose row new context registrations select. */
|
|
39
|
-
export const SELECTED_CLAUDE_CODE_VERSION = '2.1.285';
|
|
40
|
-
/** A compatibility declaration, not an observation that a host enabled or delivered hooks. */
|
|
41
|
-
export function lifecycleProfile(host, version) {
|
|
42
|
-
string(host, 64);
|
|
43
|
-
string(version, 64);
|
|
44
|
-
return profileFromRows(claudeCodeRows, host, version);
|
|
45
|
-
}
|
|
46
|
-
export function verifyLifecycleProfile(input) {
|
|
47
|
-
const expected = lifecycleProfile(input.host, input.version);
|
|
48
|
-
if (stableSerialize(input) !== stableSerialize(expected))
|
|
49
|
-
fail('Lifecycle profile differs from its installed definition');
|
|
50
|
-
if (!expected.available)
|
|
51
|
-
throw new LifecycleError('IA-LIFECYCLE-UNAVAILABLE', expected.reason);
|
|
52
|
-
return expected;
|
|
53
|
-
}
|
|
54
|
-
/** Each available segmented Claude Code row, keyed by its profile digest, computed once when the module loads. */
|
|
55
|
-
const segmentedRows = new Map([...claudeCodeRows.keys()].map((version) => [
|
|
56
|
-
lifecycleProfile('claude-code', version).digest,
|
|
57
|
-
frozen({ host: 'claude-code', version }),
|
|
58
|
-
]));
|
|
59
|
-
/** The available segmented row this exact digest names, or null; no version range is inferred. */
|
|
60
|
-
export function segmentedLifecycleRow(digest) {
|
|
61
|
-
return typeof digest === 'string' ? (segmentedRows.get(digest) ?? null) : null;
|
|
62
|
-
}
|
|
63
|
-
/** True only for the digest of an available segmented Claude Code row; no version range is inferred. */
|
|
64
|
-
export function isSegmentedLifecycleProfile(digest) {
|
|
65
|
-
return segmentedLifecycleRow(digest) !== null;
|
|
66
|
-
}
|
|
67
|
-
/** Decode bounded host metadata only. No transcript, path, module or credential is opened. */
|
|
68
|
-
export function decodeLifecycleEvent(inputProfile, input) {
|
|
69
|
-
const profile = verifyLifecycleProfile(inputProfile);
|
|
70
|
-
if (profile.host === 'ia-native')
|
|
71
|
-
fail('Native context requires the trusted native event factory');
|
|
72
|
-
if (typeof input !== 'string' ||
|
|
73
|
-
Buffer.byteLength(input) > profile.maxInputBytes ||
|
|
74
|
-
Buffer.from(input).toString('utf8') !== input)
|
|
75
|
-
fail('Lifecycle input exceeds its byte bound or is invalid UTF-8');
|
|
76
|
-
let decoded;
|
|
77
|
-
try {
|
|
78
|
-
decoded = decodeJson(input);
|
|
79
|
-
}
|
|
80
|
-
catch {
|
|
81
|
-
fail('Lifecycle input is not bounded unambiguous JSON');
|
|
82
|
-
}
|
|
83
|
-
const common = [
|
|
84
|
-
'session_id',
|
|
85
|
-
'prompt_id',
|
|
86
|
-
'transcript_path',
|
|
87
|
-
'cwd',
|
|
88
|
-
'scratchpad_dir',
|
|
89
|
-
'permission_mode',
|
|
90
|
-
'effort',
|
|
91
|
-
'hook_event_name',
|
|
92
|
-
'agent_id',
|
|
93
|
-
'agent_type',
|
|
94
|
-
];
|
|
95
|
-
const row = object(decoded, [
|
|
96
|
-
...common,
|
|
97
|
-
'source',
|
|
98
|
-
'model',
|
|
99
|
-
'session_title',
|
|
100
|
-
'seconds_since_last_response',
|
|
101
|
-
'context_tokens',
|
|
102
|
-
'prompt_cache_likely_expired',
|
|
103
|
-
'estimated_cache_write_usd',
|
|
104
|
-
'prompt',
|
|
105
|
-
]);
|
|
106
|
-
const event = string(row['hook_event_name'], 64);
|
|
107
|
-
if (!profile.events.includes(event))
|
|
108
|
-
fail('Unsupported lifecycle event');
|
|
109
|
-
const promptFields = profile.host === 'claude-code' ? claudeCodeRows.get(profile.version) : undefined;
|
|
110
|
-
if (!promptFields)
|
|
111
|
-
fail('Unsupported lifecycle event');
|
|
112
|
-
const start = event === 'SessionStart', eventFields = start
|
|
113
|
-
? [
|
|
114
|
-
'source',
|
|
115
|
-
'model',
|
|
116
|
-
'session_title',
|
|
117
|
-
'seconds_since_last_response',
|
|
118
|
-
'context_tokens',
|
|
119
|
-
'prompt_cache_likely_expired',
|
|
120
|
-
'estimated_cache_write_usd',
|
|
121
|
-
]
|
|
122
|
-
: promptFields;
|
|
123
|
-
object(row, [...common, ...eventFields]);
|
|
124
|
-
const session = string(row['session_id'], 256), cwd = string(row['cwd']), agent = row['agent_id'] === undefined ? null : string(row['agent_id'], 256), promptId = row['prompt_id'] === undefined ? null : string(row['prompt_id'], 256);
|
|
125
|
-
for (const key of ['transcript_path', 'scratchpad_dir', 'agent_type', 'model', 'session_title'])
|
|
126
|
-
if (row[key] !== undefined)
|
|
127
|
-
string(row[key]);
|
|
128
|
-
if (row['permission_mode'] !== undefined &&
|
|
129
|
-
!['default', 'plan', 'acceptEdits', 'auto', 'dontAsk', 'bypassPermissions'].includes(string(row['permission_mode'], 32)))
|
|
130
|
-
fail('Unknown permission mode metadata');
|
|
131
|
-
if (row['effort'] !== undefined) {
|
|
132
|
-
const effort = object(row['effort'], ['level']);
|
|
133
|
-
if (!['low', 'medium', 'high', 'xhigh', 'max'].includes(string(effort['level'], 16)))
|
|
134
|
-
fail('Unknown effort metadata');
|
|
135
|
-
}
|
|
136
|
-
for (const key of ['seconds_since_last_response', 'context_tokens', 'estimated_cache_write_usd'])
|
|
137
|
-
if (row[key] !== undefined &&
|
|
138
|
-
(typeof row[key] !== 'number' ||
|
|
139
|
-
!Number.isFinite(row[key]) ||
|
|
140
|
-
row[key] < 0 ||
|
|
141
|
-
(key === 'context_tokens' && !Number.isSafeInteger(row[key]))))
|
|
142
|
-
fail('Invalid cost metadata');
|
|
143
|
-
if (row['prompt_cache_likely_expired'] !== undefined && typeof row['prompt_cache_likely_expired'] !== 'boolean')
|
|
144
|
-
fail('Invalid cache metadata');
|
|
145
|
-
const source = start ? string(row['source'], 16) : null;
|
|
146
|
-
if (source !== null && !['startup', 'resume', 'clear', 'compact', 'fork'].includes(source))
|
|
147
|
-
fail('Unsupported SessionStart source');
|
|
148
|
-
const prompt = start ? null : string(row['prompt'], profile.maxPromptBytes, true);
|
|
149
|
-
const key = !start && promptId !== null
|
|
150
|
-
? metadataDigest({
|
|
151
|
-
format: 'ia.lifecycle-input-key.v1',
|
|
152
|
-
profile: profile.digest,
|
|
153
|
-
session,
|
|
154
|
-
agent,
|
|
155
|
-
promptId,
|
|
156
|
-
event,
|
|
157
|
-
})
|
|
158
|
-
: null;
|
|
159
|
-
return frozen({
|
|
160
|
-
format: 'ia.lifecycle-event.v1',
|
|
161
|
-
profile: profile.digest,
|
|
162
|
-
host: profile.host,
|
|
163
|
-
kind: start ? 'start' : 'prompt',
|
|
164
|
-
source: source,
|
|
165
|
-
session,
|
|
166
|
-
agent,
|
|
167
|
-
cwd,
|
|
168
|
-
promptId,
|
|
169
|
-
prompt,
|
|
170
|
-
key,
|
|
171
|
-
inputDigest: metadataDigest(row),
|
|
172
|
-
delivery: 'unconfirmed',
|
|
173
|
-
});
|
|
174
|
-
}
|
|
175
|
-
/** Authenticated native hosts supply their own retained session/profile/attempt, never a coding-host transcript. */
|
|
176
|
-
export function createNativeLifecycleEvent(input) {
|
|
177
|
-
const row = object(input, ['session', 'profile', 'invocation', 'text']), profile = lifecycleProfile('ia-native', '1');
|
|
178
|
-
const session = string(row['session'], 256), agent = string(row['profile'], 256), prompt = string(row['text'], profile.maxPromptBytes, true);
|
|
179
|
-
const promptId = row['invocation'] === null ? null : string(row['invocation'], 256);
|
|
180
|
-
const key = promptId === null
|
|
181
|
-
? null
|
|
182
|
-
: metadataDigest({
|
|
183
|
-
format: 'ia.lifecycle-input-key.v1',
|
|
184
|
-
profile: profile.digest,
|
|
185
|
-
session,
|
|
186
|
-
agent,
|
|
187
|
-
promptId,
|
|
188
|
-
event: 'NativeContext',
|
|
189
|
-
});
|
|
190
|
-
return frozen({
|
|
191
|
-
format: 'ia.lifecycle-event.v1',
|
|
192
|
-
profile: profile.digest,
|
|
193
|
-
host: profile.host,
|
|
194
|
-
kind: 'native',
|
|
195
|
-
source: null,
|
|
196
|
-
session,
|
|
197
|
-
agent,
|
|
198
|
-
cwd: '',
|
|
199
|
-
promptId,
|
|
200
|
-
prompt,
|
|
201
|
-
key,
|
|
202
|
-
inputDigest: metadataDigest({ session, agent, promptId, prompt }),
|
|
203
|
-
delivery: 'unconfirmed',
|
|
204
|
-
});
|
|
205
|
-
}
|
|
1
|
+
/** @deprecated Import from @inventarch/workspace-runtime/lifecycle-profile. */
|
|
2
|
+
export * from '@inventarch/workspace-runtime/lifecycle-profile';
|
|
206
3
|
//# sourceMappingURL=lifecycle-profile.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lifecycle-profile.js","sourceRoot":"","sources":["../src/lifecycle-profile.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"lifecycle-profile.js","sourceRoot":"","sources":["../src/lifecycle-profile.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,cAAc,iDAAiD,CAAC"}
|