@inneranimalmedia/agentsam-sdk 1.2.0 → 1.5.1

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.
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import { createRoot } from 'react-dom/client';
3
+ import App from './App.tsx';
4
+
5
+ createRoot(document.getElementById('root')).render(
6
+ <React.StrictMode>
7
+ <App />
8
+ </React.StrictMode>,
9
+ );
@@ -0,0 +1,19 @@
1
+ {
2
+ "name": "@inneranimalmedia/agentsam-shell-example",
3
+ "private": true,
4
+ "type": "module",
5
+ "description": "Phase 0 Gorilla Shell — game-feel CLI UX prototype for Agent Sam SDK",
6
+ "scripts": {
7
+ "dev": "vite",
8
+ "build": "vite build",
9
+ "preview": "vite preview"
10
+ },
11
+ "dependencies": {
12
+ "react": "^19.1.0",
13
+ "react-dom": "^19.1.0"
14
+ },
15
+ "devDependencies": {
16
+ "@vitejs/plugin-react": "^4.5.2",
17
+ "vite": "^6.3.5"
18
+ }
19
+ }
@@ -0,0 +1,21 @@
1
+ import { defineConfig } from 'vite';
2
+ import react from '@vitejs/plugin-react';
3
+
4
+ export default defineConfig({
5
+ root: 'gorilla',
6
+ plugins: [react()],
7
+ server: {
8
+ port: 5173,
9
+ strictPort: true,
10
+ proxy: {
11
+ '/api': {
12
+ target: 'http://127.0.0.1:8787',
13
+ changeOrigin: true,
14
+ },
15
+ },
16
+ },
17
+ build: {
18
+ outDir: '../dist/gorilla',
19
+ emptyOutDir: true,
20
+ },
21
+ });
package/test/smoke.mjs CHANGED
@@ -3,7 +3,10 @@ import fs from 'node:fs';
3
3
  import os from 'node:os';
4
4
  import path from 'node:path';
5
5
  import { AgentSam, routeIntent, getToolCatalog } from '../src/index.js';
6
- import { scaffoldProject } from '../src/lib/scaffold.js';
6
+ import { buildLocalScaffoldMeta } from '../src/lib/local-scaffold.js';
7
+ import { writeScaffoldFiles } from '../src/lib/write-files.js';
8
+ import { copyGorillaTemplate } from '../src/lib/gorilla-template.js';
9
+ import { printContextSummary, missingForInit } from '../src/lib/detect-context.js';
7
10
 
8
11
  const app = new AgentSam({ project: 'smoke', lane: 'cms', agent: 'cms' });
9
12
  let res = await app.handle(new Request('https://example.com/api/health'));
@@ -27,10 +30,11 @@ assert.equal(routeIntent({ message: 'drop table users' }).requires_approval, tru
27
30
  assert.ok(getToolCatalog('Data Solutions').some((tool) => tool.name === 'query'));
28
31
 
29
32
  const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'agentsam-sdk-test-'));
30
- const cwd = process.cwd();
31
- process.chdir(tmp);
32
- const dir = scaffoldProject({ projectName: 'CMS Demo', lane: 'CMS', provider: 'Cloudflare Workers', agent: 'cms' });
33
- process.chdir(cwd);
33
+ const dir = writeScaffoldFiles(path.join(tmp, 'demo-project'), [
34
+ { path: 'src/index.js', content: 'export default {};\n' },
35
+ { path: 'migrations/0001_agentsam_core.sql', content: 'CREATE TABLE cms_pages (id TEXT);\n' },
36
+ { path: 'package.json', content: '{"name":"demo","devDependencies":{"wrangler":"^4"}}\n' },
37
+ ]);
34
38
  assert.ok(fs.existsSync(path.join(dir, 'src/index.js')));
35
39
  assert.ok(fs.readFileSync(path.join(dir, 'migrations/0001_agentsam_core.sql'), 'utf8').includes('cms_pages'));
36
40
  assert.ok(fs.readFileSync(path.join(dir, 'package.json'), 'utf8').includes('wrangler'));
@@ -39,4 +43,28 @@ import { SLASH_COMMANDS, listSlashCommands } from '../src/lib/slash-commands.js'
39
43
  assert.ok(SLASH_COMMANDS.some((c) => c.cmd === '/deploy'));
40
44
  assert.equal(listSlashCommands({ lane: 'deploy' }).length, 2);
41
45
 
46
+ printContextSummary({
47
+ iam: { ready: true, source: 'sdk-token', detail: 'AGENTSAM_SDK_TOKEN' },
48
+ gcp: { source: 'vm-metadata', email: 'execos@project.iam.gserviceaccount.com' },
49
+ gcp_vm: true,
50
+ github: { source: 'gh-cli', account: 'connor@example.com' },
51
+ cloudflare: { source: 'wrangler', account: 'connor@cloudflare.test' },
52
+ });
53
+ assert.deepEqual(missingForInit({ iam: { ready: false } }, '', { runTarget: 'local' }), []);
54
+ assert.deepEqual(missingForInit({ iam: { ready: false } }, '', { runTarget: 'cloudflare' }), ['iam']);
55
+
56
+ const localMeta = buildLocalScaffoldMeta({ projectName: 'demo', lane: 'cms', runTarget: 'local' });
57
+ assert.equal(localMeta.laneKey, 'cms');
58
+ assert.ok(localMeta.files.some((f) => f.path === '.agentsam/start-local.md'));
59
+ assert.ok(localMeta.files.some((f) => f.path === 'wrangler.toml'));
60
+ assert.ok(localMeta.files.some((f) => f.path === '.env'));
61
+ assert.ok(!localMeta.files.some((f) => f.path.includes('execos')));
62
+
63
+ const gorillaDir = path.join(tmp, 'gorilla-project');
64
+ writeScaffoldFiles(gorillaDir, localMeta.files);
65
+ copyGorillaTemplate(gorillaDir, localMeta);
66
+ assert.ok(fs.existsSync(path.join(gorillaDir, 'gorilla', 'App.tsx')));
67
+ assert.ok(fs.existsSync(path.join(gorillaDir, 'vite.config.js')));
68
+ assert.ok(fs.readFileSync(path.join(gorillaDir, 'gorilla', 'App.tsx'), 'utf8').includes('demo'));
69
+
42
70
  console.log('SDK smoke tests passed');