@sourcegraph/amp-sdk 0.1.0-20251020161918-gf8ab86d → 0.1.0-20251021152627-g8658f12
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/index.js +4288 -338
- package/package.json +2 -2
- package/dist/types.js +0 -127
package/package.json
CHANGED
|
@@ -44,9 +44,9 @@
|
|
|
44
44
|
},
|
|
45
45
|
"type": "module",
|
|
46
46
|
"types": "dist/index.d.ts",
|
|
47
|
-
"version": "0.1.0-
|
|
47
|
+
"version": "0.1.0-20251021152627-g8658f12",
|
|
48
48
|
"scripts": {
|
|
49
|
-
"build": "
|
|
49
|
+
"build": "bun run scripts/build.ts",
|
|
50
50
|
"dev": "pnpm exec tsc -b --watch",
|
|
51
51
|
"clean": "rm -rf dist tsconfig.tsbuildinfo",
|
|
52
52
|
"examples:basic": "pnpm run build && bun run examples/basic.ts",
|
package/dist/types.js
DELETED
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* TypeScript SDK types for Amp CLI
|
|
3
|
-
*
|
|
4
|
-
* These types are compatible with the Amp CLI --stream-json output.
|
|
5
|
-
*/
|
|
6
|
-
import { z } from 'zod';
|
|
7
|
-
// ============================================================================
|
|
8
|
-
// User Message Schemas & Types
|
|
9
|
-
// ============================================================================
|
|
10
|
-
/** User input message schema */
|
|
11
|
-
export const UserInputMessageSchema = z.object({
|
|
12
|
-
type: z.literal('user'),
|
|
13
|
-
message: z.object({
|
|
14
|
-
role: z.literal('user'),
|
|
15
|
-
content: z.array(z.object({
|
|
16
|
-
type: z.literal('text'),
|
|
17
|
-
text: z.string(),
|
|
18
|
-
})),
|
|
19
|
-
}),
|
|
20
|
-
});
|
|
21
|
-
/** Permission match condition for tool arguments schema */
|
|
22
|
-
export const PermissionMatchConditionSchema = z.lazy(() => z.union([
|
|
23
|
-
z.string().describe('Pattern match where "*" matches any number of any characters'),
|
|
24
|
-
z.array(PermissionMatchConditionSchema).min(1).describe('OR match of each entry'),
|
|
25
|
-
z.boolean().describe('A literal boolean match'),
|
|
26
|
-
z.number().describe('A literal number match'),
|
|
27
|
-
z.null().describe('A literal null match'),
|
|
28
|
-
z.undefined().describe('A literal undefined match'),
|
|
29
|
-
z
|
|
30
|
-
.record(z.string(), PermissionMatchConditionSchema)
|
|
31
|
-
.describe('Matching individual keys of an object'),
|
|
32
|
-
]));
|
|
33
|
-
/** Individual permission schema */
|
|
34
|
-
export const PermissionSchema = z
|
|
35
|
-
.object({
|
|
36
|
-
tool: z.string().min(1).describe('The name of the tool to which this entry applies'),
|
|
37
|
-
matches: z
|
|
38
|
-
.record(z.string(), PermissionMatchConditionSchema)
|
|
39
|
-
.optional()
|
|
40
|
-
.describe('Maps tool inputs to conditions'),
|
|
41
|
-
action: z
|
|
42
|
-
.enum(['allow', 'reject', 'ask', 'delegate'])
|
|
43
|
-
.describe('How Amp should proceed in case of a match'),
|
|
44
|
-
context: z
|
|
45
|
-
.enum(['thread', 'subagent'])
|
|
46
|
-
.optional()
|
|
47
|
-
.describe('Only apply this entry in this context'),
|
|
48
|
-
to: z
|
|
49
|
-
.string()
|
|
50
|
-
.min(1)
|
|
51
|
-
.optional()
|
|
52
|
-
.describe('Command to delegate to when action is "delegate"'),
|
|
53
|
-
})
|
|
54
|
-
.superRefine((data, ctx) => {
|
|
55
|
-
if (data.action === 'delegate' && !data.to) {
|
|
56
|
-
ctx.addIssue({
|
|
57
|
-
code: z.ZodIssueCode.custom,
|
|
58
|
-
message: 'delegate action requires "to" field',
|
|
59
|
-
path: ['to'],
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
if (data.action !== 'delegate' && data.to) {
|
|
63
|
-
ctx.addIssue({
|
|
64
|
-
code: z.ZodIssueCode.custom,
|
|
65
|
-
message: '"to" field only allowed with delegate action',
|
|
66
|
-
path: ['to'],
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
// ============================================================================
|
|
71
|
-
// MCP Schemas & Types
|
|
72
|
-
// ============================================================================
|
|
73
|
-
/** MCP server configuration schema */
|
|
74
|
-
export const MCPServerSchema = z.object({
|
|
75
|
-
command: z.string().describe('Command to run the MCP server'),
|
|
76
|
-
args: z.array(z.string()).describe('Arguments for the MCP server command').optional(),
|
|
77
|
-
env: z
|
|
78
|
-
.record(z.string(), z.string())
|
|
79
|
-
.describe('Environment variables for the server')
|
|
80
|
-
.optional(),
|
|
81
|
-
});
|
|
82
|
-
/** MCP configuration schema */
|
|
83
|
-
export const MCPConfigSchema = z
|
|
84
|
-
.record(z.string(), MCPServerSchema)
|
|
85
|
-
.describe('MCP server configurations keyed by server name');
|
|
86
|
-
// ============================================================================
|
|
87
|
-
// Execute Schemas & Types
|
|
88
|
-
// ============================================================================
|
|
89
|
-
/** Configuration options for Amp execution schema */
|
|
90
|
-
export const AmpOptionsSchema = z
|
|
91
|
-
.object({
|
|
92
|
-
cwd: z.string().describe('Current working directory').optional(),
|
|
93
|
-
dangerouslyAllowAll: z
|
|
94
|
-
.boolean()
|
|
95
|
-
.describe('Allow all tool usage without asking for permission')
|
|
96
|
-
.optional(),
|
|
97
|
-
visibility: z
|
|
98
|
-
.enum(['private', 'public', 'workspace', 'group'])
|
|
99
|
-
.describe('Visibility level for new threads')
|
|
100
|
-
.default('workspace')
|
|
101
|
-
.optional(),
|
|
102
|
-
settingsFile: z.string().describe('Settings file path').optional(),
|
|
103
|
-
logLevel: z
|
|
104
|
-
.enum(['debug', 'info', 'warn', 'error', 'audit'])
|
|
105
|
-
.describe('Log level')
|
|
106
|
-
.optional(),
|
|
107
|
-
logFile: z.string().describe('Log file path').optional(),
|
|
108
|
-
mcpConfig: z
|
|
109
|
-
.union([z.string(), MCPConfigSchema])
|
|
110
|
-
.describe('MCP server configuration as JSON string, path to JSON file, or config object')
|
|
111
|
-
.optional(),
|
|
112
|
-
env: z
|
|
113
|
-
.record(z.string(), z.string())
|
|
114
|
-
.describe('Additional environment variables')
|
|
115
|
-
.optional(),
|
|
116
|
-
continue: z
|
|
117
|
-
.union([z.boolean(), z.string()])
|
|
118
|
-
.describe('Continue the most recent thread (true) or a specific thread by ID (string)')
|
|
119
|
-
.optional(),
|
|
120
|
-
toolbox: z.string().describe('Folder path with toolbox scripts').optional(),
|
|
121
|
-
permissions: z
|
|
122
|
-
.array(PermissionSchema)
|
|
123
|
-
.describe('Permission rules for tool usage')
|
|
124
|
-
.optional(),
|
|
125
|
-
})
|
|
126
|
-
.strict();
|
|
127
|
-
//# sourceMappingURL=types.js.map
|