@amalgm/live 0.2.81-preview.34320593070 → 0.2.81-preview.34546319610

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.
Files changed (67) hide show
  1. package/dist/index.d.ts +1 -0
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +1 -0
  4. package/dist/index.js.map +1 -1
  5. package/dist/sharing/access.d.ts +13 -0
  6. package/dist/sharing/access.d.ts.map +1 -0
  7. package/dist/sharing/access.js +26 -0
  8. package/dist/sharing/access.js.map +1 -0
  9. package/dist/sharing/cli.d.ts +22 -0
  10. package/dist/sharing/cli.d.ts.map +1 -0
  11. package/dist/sharing/cli.js +103 -0
  12. package/dist/sharing/cli.js.map +1 -0
  13. package/dist/sharing/command-input.d.ts +36 -0
  14. package/dist/sharing/command-input.d.ts.map +1 -0
  15. package/dist/sharing/command-input.js +73 -0
  16. package/dist/sharing/command-input.js.map +1 -0
  17. package/dist/sharing/command-surface.d.ts +37 -0
  18. package/dist/sharing/command-surface.d.ts.map +1 -0
  19. package/dist/sharing/command-surface.js +170 -0
  20. package/dist/sharing/command-surface.js.map +1 -0
  21. package/dist/sharing/errors.d.ts +9 -0
  22. package/dist/sharing/errors.d.ts.map +1 -0
  23. package/dist/sharing/errors.js +11 -0
  24. package/dist/sharing/errors.js.map +1 -0
  25. package/dist/sharing/index.d.ts +19 -0
  26. package/dist/sharing/index.d.ts.map +1 -0
  27. package/dist/sharing/index.js +13 -0
  28. package/dist/sharing/index.js.map +1 -0
  29. package/dist/sharing/mcp.d.ts +27 -0
  30. package/dist/sharing/mcp.d.ts.map +1 -0
  31. package/dist/sharing/mcp.js +31 -0
  32. package/dist/sharing/mcp.js.map +1 -0
  33. package/dist/sharing/pack.d.ts +21 -0
  34. package/dist/sharing/pack.d.ts.map +1 -0
  35. package/dist/sharing/pack.js +130 -0
  36. package/dist/sharing/pack.js.map +1 -0
  37. package/dist/sharing/sharing.d.ts +66 -0
  38. package/dist/sharing/sharing.d.ts.map +1 -0
  39. package/dist/sharing/sharing.js +200 -0
  40. package/dist/sharing/sharing.js.map +1 -0
  41. package/dist/sharing/types.d.ts +132 -0
  42. package/dist/sharing/types.d.ts.map +1 -0
  43. package/dist/sharing/types.js +10 -0
  44. package/dist/sharing/types.js.map +1 -0
  45. package/dist-cjs/index.js +1 -0
  46. package/dist-cjs/index.js.map +1 -1
  47. package/dist-cjs/sharing/access.js +31 -0
  48. package/dist-cjs/sharing/access.js.map +1 -0
  49. package/dist-cjs/sharing/cli.js +108 -0
  50. package/dist-cjs/sharing/cli.js.map +1 -0
  51. package/dist-cjs/sharing/command-input.js +81 -0
  52. package/dist-cjs/sharing/command-input.js.map +1 -0
  53. package/dist-cjs/sharing/command-surface.js +175 -0
  54. package/dist-cjs/sharing/command-surface.js.map +1 -0
  55. package/dist-cjs/sharing/errors.js +14 -0
  56. package/dist-cjs/sharing/errors.js.map +1 -0
  57. package/dist-cjs/sharing/index.js +34 -0
  58. package/dist-cjs/sharing/index.js.map +1 -0
  59. package/dist-cjs/sharing/mcp.js +33 -0
  60. package/dist-cjs/sharing/mcp.js.map +1 -0
  61. package/dist-cjs/sharing/pack.js +138 -0
  62. package/dist-cjs/sharing/pack.js.map +1 -0
  63. package/dist-cjs/sharing/sharing.js +203 -0
  64. package/dist-cjs/sharing/sharing.js.map +1 -0
  65. package/dist-cjs/sharing/types.js +11 -0
  66. package/dist-cjs/sharing/types.js.map +1 -0
  67. package/package.json +10 -4
package/dist/index.d.ts CHANGED
@@ -21,4 +21,5 @@ export * from './files/index.js';
21
21
  export * from './transfer/index.js';
22
22
  export * from './merge/index.js';
23
23
  export * from './workspace/index.js';
24
+ export * from './sharing/index.js';
24
25
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC"}
package/dist/index.js CHANGED
@@ -21,4 +21,5 @@ export * from './files/index.js';
21
21
  export * from './transfer/index.js';
22
22
  export * from './merge/index.js';
23
23
  export * from './workspace/index.js';
24
+ export * from './sharing/index.js';
24
25
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * The one access law for shared constructs, and the projection each actor
3
+ * may see of a record.
4
+ */
5
+ import type { ShareActor, ShareRecord, ShareView } from './types.js';
6
+ declare function normalizeEmail(email: string): string;
7
+ declare function isOwner(record: ShareRecord, actor: ShareActor): boolean;
8
+ /** Owner always; anyone signed in for link shares; listed emails otherwise. */
9
+ declare function canAccess(record: ShareRecord, actor: ShareActor): boolean;
10
+ /** Only the owner sees who was granted access and which constructs feed the share. */
11
+ declare function viewOf(record: ShareRecord, actor: ShareActor): ShareView;
12
+ export { canAccess, isOwner, normalizeEmail, viewOf };
13
+ //# sourceMappingURL=access.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"access.d.ts","sourceRoot":"","sources":["../../src/sharing/access.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAErE,iBAAS,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE7C;AAED,iBAAS,OAAO,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,UAAU,GAAG,OAAO,CAEhE;AAED,+EAA+E;AAC/E,iBAAS,SAAS,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,UAAU,GAAG,OAAO,CAKlE;AAED,sFAAsF;AACtF,iBAAS,MAAM,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,UAAU,GAAG,SAAS,CAGjE;AAED,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,CAAC"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * The one access law for shared constructs, and the projection each actor
3
+ * may see of a record.
4
+ */
5
+ function normalizeEmail(email) {
6
+ return email.trim().toLowerCase();
7
+ }
8
+ function isOwner(record, actor) {
9
+ return record.ownerId === actor.userId;
10
+ }
11
+ /** Owner always; anyone signed in for link shares; listed emails otherwise. */
12
+ function canAccess(record, actor) {
13
+ if (isOwner(record, actor))
14
+ return true;
15
+ if (record.visibility === 'anyone_with_link')
16
+ return true;
17
+ const email = normalizeEmail(actor.email);
18
+ return email !== '' && record.people.some((person) => normalizeEmail(person.email) === email);
19
+ }
20
+ /** Only the owner sees who was granted access and which constructs feed the share. */
21
+ function viewOf(record, actor) {
22
+ const { people, source, ...shared } = record;
23
+ return isOwner(record, actor) ? { ...shared, role: 'owner', people, source } : { ...shared, role: 'viewer' };
24
+ }
25
+ export { canAccess, isOwner, normalizeEmail, viewOf };
26
+ //# sourceMappingURL=access.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"access.js","sourceRoot":"","sources":["../../src/sharing/access.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,SAAS,cAAc,CAAC,KAAa;IACnC,OAAO,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;AACpC,CAAC;AAED,SAAS,OAAO,CAAC,MAAmB,EAAE,KAAiB;IACrD,OAAO,MAAM,CAAC,OAAO,KAAK,KAAK,CAAC,MAAM,CAAC;AACzC,CAAC;AAED,+EAA+E;AAC/E,SAAS,SAAS,CAAC,MAAmB,EAAE,KAAiB;IACvD,IAAI,OAAO,CAAC,MAAM,EAAE,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACxC,IAAI,MAAM,CAAC,UAAU,KAAK,kBAAkB;QAAE,OAAO,IAAI,CAAC;IAC1D,MAAM,KAAK,GAAG,cAAc,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC1C,OAAO,KAAK,KAAK,EAAE,IAAI,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,cAAc,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,KAAK,CAAC,CAAC;AAChG,CAAC;AAED,sFAAsF;AACtF,SAAS,MAAM,CAAC,MAAmB,EAAE,KAAiB;IACpD,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,GAAG,MAAM,CAAC;IAC7C,OAAO,OAAO,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;AAC/G,CAAC;AAED,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,CAAC"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * CLI adapter over the Sharing command surface. It only turns argv into the
3
+ * command's input object and the result into text; the command list,
4
+ * validation, and SDK calls are shared with MCP. It is pure: the host writes
5
+ * the returned streams and exits with the returned code.
6
+ */
7
+ import type { ShareCommands } from './command-surface.js';
8
+ interface ShareCliResult {
9
+ exitCode: 0 | 1;
10
+ stdout: string;
11
+ stderr: string;
12
+ }
13
+ interface ParsedShareCli {
14
+ command: string | undefined;
15
+ input: Record<string, unknown>;
16
+ }
17
+ declare const SHARE_CLI_HELP: string;
18
+ declare function parseShareCli(argv: string[]): ParsedShareCli;
19
+ declare function runShareCli(argv: string[], commands: ShareCommands): Promise<ShareCliResult>;
20
+ export { SHARE_CLI_HELP, parseShareCli, runShareCli };
21
+ export type { ParsedShareCli, ShareCliResult };
22
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/sharing/cli.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAA0B,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAElF,UAAU,cAAc;IACtB,QAAQ,EAAE,CAAC,GAAG,CAAC,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,UAAU,cAAc;IACtB,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC;AAED,QAAA,MAAM,cAAc,QAWZ,CAAC;AAoCT,iBAAS,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,cAAc,CAiCrD;AAED,iBAAe,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,aAAa,GAAG,OAAO,CAAC,cAAc,CAAC,CAS3F;AAED,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,WAAW,EAAE,CAAC;AACtD,YAAY,EAAE,cAAc,EAAE,cAAc,EAAE,CAAC"}
@@ -0,0 +1,103 @@
1
+ /**
2
+ * CLI adapter over the Sharing command surface. It only turns argv into the
3
+ * command's input object and the result into text; the command list,
4
+ * validation, and SDK calls are shared with MCP. It is pure: the host writes
5
+ * the returned streams and exits with the returned code.
6
+ */
7
+ import { shareCommandDefinition, shareCommandDefinitions } from './command-surface.js';
8
+ const SHARE_CLI_HELP = `Usage: amalgm share <command> [arguments] [--field value | --no-field]
9
+ amalgm share <command> --input JSON
10
+
11
+ Commands (identical to the Sharing MCP tools):
12
+ ${shareCommandDefinitions.map(usage).join('\n')}
13
+
14
+ Bare arguments fill the fields listed in order. Any field can be given as
15
+ --field value (--share-id, --title, ...); list fields take comma-separated
16
+ values or repeated flags (--automation-ids a,b or --automation-ids a
17
+ --automation-ids b). --input takes the whole input as one JSON object.
18
+ Output is the command result as JSON; failures print the error message and
19
+ exit 1.`;
20
+ function usage(definition) {
21
+ const positional = definition.positional.map((field) => (definition.inputShape[field].required ? `<${flag(field)}>` : `[${flag(field)}]`));
22
+ const flags = Object.entries(definition.inputShape)
23
+ .filter(([field]) => !definition.positional.includes(field))
24
+ .map(([field, shape]) => (shape.type === 'boolean' ? `[--[no-]${flag(field)}]` : `[--${flag(field)} ${shape.type}]`));
25
+ return ` ${[definition.name, ...positional, ...flags].join(' ')}\n ${definition.description}`;
26
+ }
27
+ function flag(field) {
28
+ return field.replace(/_/g, '-');
29
+ }
30
+ function field(flagName) {
31
+ return flagName.replace(/-/g, '_');
32
+ }
33
+ function coerce(definition, name, raw, previous) {
34
+ const shape = definition.inputShape[name];
35
+ if (!shape)
36
+ throw new Error(`Unknown option for ${definition.name}: --${flag(name)}`);
37
+ if (shape.type === 'integer') {
38
+ const value = Number(raw);
39
+ if (!Number.isInteger(value))
40
+ throw new Error(`--${flag(name)} must be an integer`);
41
+ return value;
42
+ }
43
+ if (shape.type === 'object')
44
+ return JSON.parse(raw);
45
+ if (shape.type === 'strings') {
46
+ const items = raw.split(',').map((item) => item.trim()).filter(Boolean);
47
+ return Array.isArray(previous) ? [...previous, ...items] : items;
48
+ }
49
+ return raw;
50
+ }
51
+ function parseShareCli(argv) {
52
+ const args = [...argv];
53
+ const command = args.shift();
54
+ if (!command || ['help', '--help', '-h'].includes(command))
55
+ return { command: undefined, input: {} };
56
+ const definition = shareCommandDefinition(command);
57
+ const input = {};
58
+ const bare = [];
59
+ for (let index = 0; index < args.length; index += 1) {
60
+ const value = args[index];
61
+ if (!value.startsWith('--')) {
62
+ bare.push(value);
63
+ }
64
+ else if (value === '--input') {
65
+ Object.assign(input, JSON.parse(args[++index] ?? ''));
66
+ }
67
+ else if (value.startsWith('--no-') && definition.inputShape[field(value.slice(5))]?.type === 'boolean') {
68
+ input[field(value.slice(5))] = false;
69
+ }
70
+ else if (definition.inputShape[field(value.slice(2))]?.type === 'boolean') {
71
+ input[field(value.slice(2))] = true;
72
+ }
73
+ else {
74
+ const name = field(value.slice(2));
75
+ const raw = args[++index];
76
+ if (raw === undefined)
77
+ throw new Error(`--${flag(name)} needs a value`);
78
+ input[name] = coerce(definition, name, raw, input[name]);
79
+ }
80
+ }
81
+ if (bare.length > definition.positional.length) {
82
+ throw new Error(`Unexpected argument for ${command}: ${bare[definition.positional.length]}`);
83
+ }
84
+ bare.forEach((value, index) => {
85
+ const name = definition.positional[index];
86
+ input[name] = coerce(definition, name, value, input[name]);
87
+ });
88
+ return { command, input };
89
+ }
90
+ async function runShareCli(argv, commands) {
91
+ try {
92
+ const parsed = parseShareCli(argv);
93
+ if (!parsed.command)
94
+ return { exitCode: 0, stdout: `${SHARE_CLI_HELP}\n`, stderr: '' };
95
+ const result = await commands.execute(parsed.command, parsed.input);
96
+ return { exitCode: 0, stdout: `${JSON.stringify(result, null, 2)}\n`, stderr: '' };
97
+ }
98
+ catch (error) {
99
+ return { exitCode: 1, stdout: '', stderr: `${error instanceof Error ? error.message : String(error)}\n` };
100
+ }
101
+ }
102
+ export { SHARE_CLI_HELP, parseShareCli, runShareCli };
103
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/sharing/cli.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAcvF,MAAM,cAAc,GAAG;;;;EAIrB,uBAAuB,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;;;;;;;QAOvC,CAAC;AAET,SAAS,KAAK,CAAC,UAAkC;IAC/C,MAAM,UAAU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tG,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;IACrF,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;IAC5G,CAAC;AACH,CAAC;AAED,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,WAAW,EAAE,CAAC"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Declarative command inputs. One field shape per command feeds every
3
+ * adapter: the MCP tool schema, the CLI flag parser, and the validation
4
+ * every surface runs before the SDK is touched.
5
+ */
6
+ type FieldType = 'string' | 'integer' | 'boolean' | 'object' | 'strings';
7
+ interface Field {
8
+ type: FieldType;
9
+ description: string;
10
+ required?: boolean;
11
+ }
12
+ type FieldShape = Record<string, Field>;
13
+ interface JsonPropertySchema {
14
+ type: 'string' | 'integer' | 'boolean' | 'object' | 'array';
15
+ description: string;
16
+ items?: {
17
+ type: 'string';
18
+ };
19
+ }
20
+ interface JsonObjectSchema {
21
+ [key: string]: unknown;
22
+ type: 'object';
23
+ additionalProperties: false;
24
+ required: string[];
25
+ properties: Record<string, JsonPropertySchema>;
26
+ }
27
+ declare function string(description: string, required?: boolean): Field;
28
+ declare function integer(description: string, required?: boolean): Field;
29
+ declare function boolean(description: string): Field;
30
+ declare function object(description: string, required?: boolean): Field;
31
+ declare function strings(description: string, required?: boolean): Field;
32
+ declare function jsonSchema(shape: FieldShape): JsonObjectSchema;
33
+ declare function parseInput(shape: FieldShape, value: unknown): Record<string, unknown>;
34
+ export { boolean, integer, jsonSchema, object, parseInput, string, strings };
35
+ export type { Field, FieldShape, FieldType, JsonObjectSchema, JsonPropertySchema };
36
+ //# sourceMappingURL=command-input.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"command-input.d.ts","sourceRoot":"","sources":["../../src/sharing/command-input.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,KAAK,SAAS,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAC;AAEzE,UAAU,KAAK;IACb,IAAI,EAAE,SAAS,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,KAAK,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AAExC,UAAU,kBAAkB;IAC1B,IAAI,EAAE,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,CAAC;IAC5D,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE;QAAE,IAAI,EAAE,QAAQ,CAAA;KAAE,CAAC;CAC5B;AAED,UAAU,gBAAgB;IACxB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IACvB,IAAI,EAAE,QAAQ,CAAC;IACf,oBAAoB,EAAE,KAAK,CAAC;IAC5B,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;CAChD;AAED,iBAAS,MAAM,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,UAAQ,GAAG,KAAK,CAE5D;AAED,iBAAS,OAAO,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,UAAQ,GAAG,KAAK,CAE7D;AAED,iBAAS,OAAO,CAAC,WAAW,EAAE,MAAM,GAAG,KAAK,CAE3C;AAED,iBAAS,MAAM,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,UAAQ,GAAG,KAAK,CAE5D;AAED,iBAAS,OAAO,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,UAAQ,GAAG,KAAK,CAE7D;AAOD,iBAAS,UAAU,CAAC,KAAK,EAAE,UAAU,GAAG,gBAAgB,CAOvD;AAYD,iBAAS,UAAU,CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAmB9E;AAOD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;AAC7E,YAAY,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,CAAC"}
@@ -0,0 +1,73 @@
1
+ /**
2
+ * Declarative command inputs. One field shape per command feeds every
3
+ * adapter: the MCP tool schema, the CLI flag parser, and the validation
4
+ * every surface runs before the SDK is touched.
5
+ */
6
+ function string(description, required = false) {
7
+ return { type: 'string', description, required };
8
+ }
9
+ function integer(description, required = false) {
10
+ return { type: 'integer', description, required };
11
+ }
12
+ function boolean(description) {
13
+ return { type: 'boolean', description };
14
+ }
15
+ function object(description, required = false) {
16
+ return { type: 'object', description, required };
17
+ }
18
+ function strings(description, required = false) {
19
+ return { type: 'strings', description, required };
20
+ }
21
+ function propertySchema(field) {
22
+ if (field.type === 'strings')
23
+ return { type: 'array', items: { type: 'string' }, description: field.description };
24
+ return { type: field.type, description: field.description };
25
+ }
26
+ function jsonSchema(shape) {
27
+ return {
28
+ type: 'object',
29
+ additionalProperties: false,
30
+ required: Object.entries(shape).filter(([, field]) => field.required).map(([name]) => name),
31
+ properties: Object.fromEntries(Object.entries(shape).map(([name, field]) => [name, propertySchema(field)])),
32
+ };
33
+ }
34
+ function accepts(field, value) {
35
+ switch (field.type) {
36
+ case 'string': return typeof value === 'string';
37
+ case 'integer': return Number.isInteger(value);
38
+ case 'boolean': return typeof value === 'boolean';
39
+ case 'object': return Boolean(value) && typeof value === 'object' && !Array.isArray(value);
40
+ case 'strings': return Array.isArray(value) && value.every((item) => typeof item === 'string' && item.trim());
41
+ }
42
+ }
43
+ function parseInput(shape, value) {
44
+ if (!value || typeof value !== 'object' || Array.isArray(value)) {
45
+ throw new Error('Command input must be a JSON object');
46
+ }
47
+ const input = value;
48
+ const unknownFields = Object.keys(input).filter((name) => !(name in shape));
49
+ if (unknownFields.length)
50
+ throw new Error(`Unknown input field: ${unknownFields.join(', ')}`);
51
+ const parsed = {};
52
+ for (const [name, field] of Object.entries(shape)) {
53
+ const supplied = input[name];
54
+ if (supplied === undefined || supplied === null) {
55
+ if (field.required)
56
+ throw new Error(`${name} is required`);
57
+ continue;
58
+ }
59
+ if (!accepts(field, supplied))
60
+ throw new Error(`${name} must be ${expectation(field.type)}`);
61
+ if (field.type === 'string' && !supplied.trim())
62
+ throw new Error(`${name} must not be empty`);
63
+ parsed[name] = supplied;
64
+ }
65
+ return parsed;
66
+ }
67
+ function expectation(type) {
68
+ if (type === 'strings')
69
+ return 'a list of non-empty strings';
70
+ return type === 'integer' || type === 'object' ? `an ${type}` : `a ${type}`;
71
+ }
72
+ export { boolean, integer, jsonSchema, object, parseInput, string, strings };
73
+ //# sourceMappingURL=command-input.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"command-input.js","sourceRoot":"","sources":["../../src/sharing/command-input.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AA0BH,SAAS,MAAM,CAAC,WAAmB,EAAE,QAAQ,GAAG,KAAK;IACnD,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC;AACnD,CAAC;AAED,SAAS,OAAO,CAAC,WAAmB,EAAE,QAAQ,GAAG,KAAK;IACpD,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC;AACpD,CAAC;AAED,SAAS,OAAO,CAAC,WAAmB;IAClC,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,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C,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QAClD,MAAM,QAAQ,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC;QAC7B,IAAI,QAAQ,KAAK,SAAS,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;YAChD,IAAI,KAAK,CAAC,QAAQ;gBAAE,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,cAAc,CAAC,CAAC;YAC3D,SAAS;QACX,CAAC;QACD,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,QAAQ,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,YAAY,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC7F,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ,IAAI,CAAE,QAAmB,CAAC,IAAI,EAAE;YAAE,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,oBAAoB,CAAC,CAAC;QAC1G,MAAM,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC;IAC1B,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,WAAW,CAAC,IAAe;IAClC,IAAI,IAAI,KAAK,SAAS;QAAE,OAAO,6BAA6B,CAAC;IAC7D,OAAO,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;AAC9E,CAAC;AAED,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * The one Sharing command surface. Every adapter (CLI, MCP, and any later
3
+ * API) consumes this list: the same names, the same inputs, the same
4
+ * annotations, and the same SDK calls.
5
+ */
6
+ import type { FieldShape, JsonObjectSchema } from './command-input.js';
7
+ import type { Sharing } from './sharing.js';
8
+ import type { ShareActor } from './types.js';
9
+ type ShareCommandName = 'share' | 'publish_copy' | 'update' | 'list' | 'get' | 'accept' | 'revoke' | 'set_visibility' | 'grant' | 'ungrant';
10
+ interface ShareCommandAnnotations {
11
+ readOnlyHint: boolean;
12
+ destructiveHint: boolean;
13
+ idempotentHint: boolean;
14
+ openWorldHint: boolean;
15
+ }
16
+ interface ShareCommandDefinition {
17
+ name: ShareCommandName;
18
+ mcpName: `amalgm_share_${string}`;
19
+ title: string;
20
+ description: string;
21
+ inputShape: FieldShape;
22
+ /** Input fields the CLI fills from bare arguments, in order. */
23
+ positional: readonly string[];
24
+ annotations: ShareCommandAnnotations;
25
+ inputSchema(): JsonObjectSchema;
26
+ invoke(sharing: Sharing, actor: ShareActor, input: unknown): Promise<unknown>;
27
+ }
28
+ interface ShareCommands {
29
+ execute(name: ShareCommandName, input?: unknown): Promise<unknown>;
30
+ }
31
+ declare const shareCommandDefinitions: readonly ShareCommandDefinition[];
32
+ declare function shareCommandDefinition(name: string): ShareCommandDefinition;
33
+ /** Bind the surface to one SDK and one acting user; the host resolves both. */
34
+ declare function createShareCommands(sharing: Sharing, actor: ShareActor): ShareCommands;
35
+ export { createShareCommands, shareCommandDefinition, shareCommandDefinitions };
36
+ export type { ShareCommandAnnotations, ShareCommandDefinition, ShareCommandName, ShareCommands };
37
+ //# sourceMappingURL=command-surface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"command-surface.d.ts","sourceRoot":"","sources":["../../src/sharing/command-surface.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACvE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAA2B,UAAU,EAAE,MAAM,YAAY,CAAC;AAEtE,KAAK,gBAAgB,GACjB,OAAO,GAAG,cAAc,GAAG,QAAQ,GAAG,MAAM,GAAG,KAAK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any later
3
+ * API) consumes this list: the same names, the same inputs, the same
4
+ * annotations, and the same SDK calls.
5
+ */
6
+ import { jsonSchema, parseInput, string, strings } from './command-input.js';
7
+ const shareId = { share_id: string('Share id', true) };
8
+ const selection = {
9
+ agent_ids: strings('Agent ids to include'),
10
+ automation_ids: strings('Automation ids to include'),
11
+ app_ids: strings('App ids to include'),
12
+ tool_ids: strings('Tool ids to include'),
13
+ };
14
+ const naming = {
15
+ title: string('Title shown to recipients (default: the exported title)'),
16
+ description: string('Description shown to recipients (default: the exported description)'),
17
+ };
18
+ function selectionOf(input) {
19
+ return {
20
+ agentIds: input.agent_ids,
21
+ automationIds: input.automation_ids,
22
+ appIds: input.app_ids,
23
+ toolIds: input.tool_ids,
24
+ };
25
+ }
26
+ const definitions = [
27
+ define({
28
+ name: 'share',
29
+ title: 'Share constructs',
30
+ description: 'Share agents, automations, apps, or tools with lineage: the owner can update, grant, and revoke it later.',
31
+ shape: { ...selection, ...naming, visibility: string('restricted (default) or anyone_with_link') },
32
+ positional: [],
33
+ annotations: write(false),
34
+ run: (sharing, actor, input) => sharing.share(actor, {
35
+ selection: selectionOf(input),
36
+ title: input.title,
37
+ description: input.description,
38
+ visibility: input.visibility,
39
+ }),
40
+ }),
41
+ define({
42
+ name: 'publish_copy',
43
+ title: 'Publish a copy',
44
+ description: 'Publish a detached copy with no lineage: identified by its content, open to anyone with the link, never updated or revoked.',
45
+ shape: { ...selection, ...naming },
46
+ positional: [],
47
+ annotations: write(true),
48
+ run: (sharing, actor, input) => sharing.publishCopy(actor, {
49
+ selection: selectionOf(input),
50
+ title: input.title,
51
+ description: input.description,
52
+ }),
53
+ }),
54
+ define({
55
+ name: 'update',
56
+ title: 'Update share',
57
+ description: 'Re-export a linked share from its source constructs, optionally renaming it.',
58
+ shape: { ...shareId, ...naming },
59
+ positional: ['share_id'],
60
+ annotations: write(false),
61
+ run: (sharing, actor, input) => sharing.update(actor, input.share_id, {
62
+ title: input.title,
63
+ description: input.description,
64
+ }),
65
+ }),
66
+ define({
67
+ name: 'list',
68
+ title: 'List shares',
69
+ description: 'List the shares you own and the shares you have accepted.',
70
+ shape: {},
71
+ positional: [],
72
+ annotations: read(),
73
+ run: (sharing, actor) => sharing.list(actor),
74
+ }),
75
+ define({
76
+ name: 'get',
77
+ title: 'Get share',
78
+ description: 'Get one share you can access, with its bundle and your acceptance if any.',
79
+ shape: shareId,
80
+ positional: ['share_id'],
81
+ annotations: read(),
82
+ run: (sharing, actor, input) => sharing.get(actor, input.share_id),
83
+ }),
84
+ define({
85
+ name: 'accept',
86
+ title: 'Accept share',
87
+ description: 'Install the shared constructs on this computer and record the acceptance.',
88
+ shape: shareId,
89
+ positional: ['share_id'],
90
+ annotations: write(false),
91
+ run: (sharing, actor, input) => sharing.accept(actor, input.share_id),
92
+ }),
93
+ define({
94
+ name: 'revoke',
95
+ title: 'Revoke share',
96
+ description: 'Remove a linked share for everyone who accepted it. A published copy cannot be revoked.',
97
+ shape: shareId,
98
+ positional: ['share_id'],
99
+ annotations: destructive(),
100
+ run: (sharing, actor, input) => sharing.revoke(actor, input.share_id),
101
+ }),
102
+ define({
103
+ name: 'set_visibility',
104
+ title: 'Set share visibility',
105
+ description: 'Make a linked share restricted to granted people or open to anyone with the link.',
106
+ shape: { ...shareId, visibility: string('restricted or anyone_with_link', true) },
107
+ positional: ['share_id', 'visibility'],
108
+ annotations: write(true),
109
+ run: (sharing, actor, input) => sharing.setVisibility(actor, input.share_id, input.visibility),
110
+ }),
111
+ define({
112
+ name: 'grant',
113
+ title: 'Grant access',
114
+ description: 'Let one person, by email, access a restricted linked share.',
115
+ shape: { ...shareId, email: string('Email address of the person', true) },
116
+ positional: ['share_id', 'email'],
117
+ annotations: write(true),
118
+ run: (sharing, actor, input) => sharing.grant(actor, input.share_id, input.email),
119
+ }),
120
+ define({
121
+ name: 'ungrant',
122
+ title: 'Remove access',
123
+ description: 'Stop one person, by email, from accessing a restricted linked share.',
124
+ shape: { ...shareId, email: string('Email address of the person', true) },
125
+ positional: ['share_id', 'email'],
126
+ annotations: write(true),
127
+ run: (sharing, actor, input) => sharing.ungrant(actor, input.share_id, input.email),
128
+ }),
129
+ ];
130
+ const shareCommandDefinitions = definitions;
131
+ function read() {
132
+ return { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false };
133
+ }
134
+ function write(idempotentHint) {
135
+ return { readOnlyHint: false, destructiveHint: false, idempotentHint, openWorldHint: false };
136
+ }
137
+ function destructive() {
138
+ return { readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false };
139
+ }
140
+ function define(spec) {
141
+ for (const field of spec.positional) {
142
+ if (!(field in spec.shape))
143
+ throw new Error(`${spec.name} positional field is not an input: ${field}`);
144
+ }
145
+ return {
146
+ name: spec.name,
147
+ mcpName: `amalgm_share_${spec.name}`,
148
+ title: spec.title,
149
+ description: spec.description,
150
+ inputShape: spec.shape,
151
+ positional: spec.positional,
152
+ annotations: spec.annotations,
153
+ inputSchema: () => jsonSchema(spec.shape),
154
+ invoke: (sharing, actor, input) => spec.run(sharing, actor, parseInput(spec.shape, input ?? {})),
155
+ };
156
+ }
157
+ function shareCommandDefinition(name) {
158
+ const definition = shareCommandDefinitions.find((candidate) => candidate.name === name);
159
+ if (!definition)
160
+ throw new Error(`Unknown Sharing command: ${name}`);
161
+ return definition;
162
+ }
163
+ /** Bind the surface to one SDK and one acting user; the host resolves both. */
164
+ function createShareCommands(sharing, actor) {
165
+ return {
166
+ execute: (name, input = {}) => shareCommandDefinition(name).invoke(sharing, actor, input),
167
+ };
168
+ }
169
+ export { createShareCommands, shareCommandDefinition, shareCommandDefinitions };
170
+ //# sourceMappingURL=command-surface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"command-surface.js","sourceRoot":"","sources":["../../src/sharing/command-surface.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAiC7E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AAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;IACxF,IAAI,CAAC,UAAU;QAAE,MAAM,IAAI,KAAK,CAAC,4BAA4B,IAAI,EAAE,CAAC,CAAC;IACrE,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,+EAA+E;AAC/E,SAAS,mBAAmB,CAAC,OAAgB,EAAE,KAAiB;IAC9D,OAAO;QACL,OAAO,EAAE,CAAC,IAAI,EAAE,KAAK,GAAG,EAAE,EAAE,EAAE,CAAC,sBAAsB,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC;KAC1F,CAAC;AACJ,CAAC;AAED,OAAO,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,CAAC"}
@@ -0,0 +1,9 @@
1
+ /** Typed sharing failures so thin surfaces can map them without parsing text. */
2
+ type SharingErrorCode = 'invalid' | 'not_found' | 'forbidden' | 'corrupt';
3
+ declare class SharingError extends Error {
4
+ readonly code: SharingErrorCode;
5
+ constructor(code: SharingErrorCode, message: string);
6
+ }
7
+ export { SharingError };
8
+ export type { SharingErrorCode };
9
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/sharing/errors.ts"],"names":[],"mappings":"AAAA,iFAAiF;AAEjF,KAAK,gBAAgB,GAAG,SAAS,GAAG,WAAW,GAAG,WAAW,GAAG,SAAS,CAAC;AAE1E,cAAM,YAAa,SAAQ,KAAK;IAC9B,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAC;gBAEpB,IAAI,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM;CAKpD;AAED,OAAO,EAAE,YAAY,EAAE,CAAC;AACxB,YAAY,EAAE,gBAAgB,EAAE,CAAC"}
@@ -0,0 +1,11 @@
1
+ /** Typed sharing failures so thin surfaces can map them without parsing text. */
2
+ class SharingError extends Error {
3
+ code;
4
+ constructor(code, message) {
5
+ super(message);
6
+ this.name = 'SharingError';
7
+ this.code = code;
8
+ }
9
+ }
10
+ export { SharingError };
11
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/sharing/errors.ts"],"names":[],"mappings":"AAAA,iFAAiF;AAIjF,MAAM,YAAa,SAAQ,KAAK;IACrB,IAAI,CAAmB;IAEhC,YAAY,IAAsB,EAAE,OAAe;QACjD,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;QAC3B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF;AAED,OAAO,EAAE,YAAY,EAAE,CAAC"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Sharing: one subsystem for sharing every construct kind, with linked
3
+ * shares and published copies as distinct operations, one access law, and
4
+ * thin CLI and MCP doors over one command surface.
5
+ */
6
+ export { Sharing } from './sharing.js';
7
+ export type { AcceptResult, PublishCopyInput, ShareDetail, ShareInput, ShareListing, ShareUpdate, } from './sharing.js';
8
+ export { SharingError } from './errors.js';
9
+ export type { SharingErrorCode } from './errors.js';
10
+ export { canAccess, viewOf } from './access.js';
11
+ export { assertDetached, bundleIdentities, bundleKind, bundleSummary, canonicalText, normalizeSelection, parseBundle, } from './pack.js';
12
+ export { createShareCommands, shareCommandDefinition, shareCommandDefinitions } from './command-surface.js';
13
+ export type { ShareCommandAnnotations, ShareCommandDefinition, ShareCommandName, ShareCommands, } from './command-surface.js';
14
+ export { SHARE_CLI_HELP, parseShareCli, runShareCli } from './cli.js';
15
+ export type { ParsedShareCli, ShareCliResult } from './cli.js';
16
+ export { createShareMcpTools } from './mcp.js';
17
+ export type { ShareMcpResult, ShareMcpTool } from './mcp.js';
18
+ export type { ConstructPort, ConstructSelection, ConstructSelectionInput, ShareAcceptance, ShareActor, ShareBundle, ShareHead, ShareKind, ShareLineage, SharePerson, ShareRecord, ShareRole, ShareView, ShareVisibility, SharingPorts, SharingStore, } from './types.js';
19
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/sharing/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,YAAY,EACV,YAAY,EACZ,gBAAgB,EAChB,WAAW,EACX,UAAU,EACV,YAAY,EACZ,WAAW,GACZ,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,YAAY,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,UAAU,EACV,aAAa,EACb,aAAa,EACb,kBAAkB,EAClB,WAAW,GACZ,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAC5G,YAAY,EACV,uBAAuB,EACvB,sBAAsB,EACtB,gBAAgB,EAChB,aAAa,GACd,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACtE,YAAY,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC/C,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7D,YAAY,EACV,aAAa,EACb,kBAAkB,EAClB,uBAAuB,EACvB,eAAe,EACf,UAAU,EACV,WAAW,EACX,SAAS,EACT,SAAS,EACT,YAAY,EACZ,WAAW,EACX,WAAW,EACX,SAAS,EACT,SAAS,EACT,eAAe,EACf,YAAY,EACZ,YAAY,GACb,MAAM,YAAY,CAAC"}