create-polos 0.1.0 → 0.1.2

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 (2) hide show
  1. package/dist/index.js +64 -46
  2. package/package.json +6 -1
package/dist/index.js CHANGED
@@ -90,9 +90,6 @@ function tsconfigJsonTemplate() {
90
90
  // src/templates/env-example.ts
91
91
  function envExampleTemplate(provider) {
92
92
  return `${provider.envVar}=${provider.envPlaceholder}
93
- TAVILY_API_KEY=tvly-...
94
- # POLOS_API_URL=http://localhost:8080
95
- # POLOS_API_KEY=
96
93
  `;
97
94
  }
98
95
 
@@ -125,7 +122,7 @@ A Polos agent project using **${provider.label}**.
125
122
 
126
123
  3. Start the development server:
127
124
  \`\`\`bash
128
- npx polos dev
125
+ polos dev
129
126
  \`\`\`
130
127
 
131
128
  ## Project Structure
@@ -135,7 +132,8 @@ src/
135
132
  main.ts # Entry point \u2014 imports agents, starts Polos
136
133
  agents/
137
134
  coding-agent.ts # Coding agent with local sandbox tools
138
- assistant-agent.ts # Assistant with sandbox tools + web search + ask user
135
+ assistant-agent.ts # Assistant with sandbox tools + ask user
136
+ workflows/
139
137
  text-review/
140
138
  agents.ts # Grammar, tone, correctness, and editor agents
141
139
  workflow.ts # Parallel review workflow
@@ -144,12 +142,40 @@ src/
144
142
  ## Agents
145
143
 
146
144
  - **coding_agent** \u2014 A coding agent with local sandbox tools (exec, read, write, edit, glob, grep)
147
- - **assistant_agent** \u2014 An assistant with sandbox tools, web search, and ask user
148
- - **text_review** \u2014 A workflow that runs 3 reviewers in parallel, then a final editor
145
+ - **assistant_agent** \u2014 An assistant with sandbox tools and ask user
146
+
147
+ ## Workflows
148
+
149
+ - **text_review** \u2014 A workflow that runs 3 reviewer agents in parallel, then a final editor agent
150
+ - **grammar_review** \u2014 A grammar review agent
151
+ - **tone_review** \u2014 A tone review agent
152
+ - **correctness_review** \u2014 A correctness review agent
153
+ - **editor_review** \u2014 An editor review agent
154
+
155
+ ## Running an Agent
156
+
157
+ With \`polos dev\` running, open another terminal:
158
+
159
+ \`\`\`bash
160
+ # Interactive REPL
161
+ polos run assistant_agent
162
+
163
+ # One-shot
164
+ polos run assistant_agent --input "Summarize the latest news about AI"
165
+ \`\`\`
166
+
167
+ ## Running a Workflow
168
+
169
+ \`\`\`bash
170
+ polos invoke text_review --input "The quick brown fox jumps over the lazy dog."
171
+
172
+ # Check result
173
+ polos result <execution-id>
174
+ \`\`\`
149
175
 
150
176
  ## Learn More
151
177
 
152
- - [Polos Documentation](https://docs.polos.dev)
178
+ - [Polos Documentation](https://polos.dev/docs)
153
179
  `;
154
180
  }
155
181
 
@@ -161,10 +187,24 @@ import { Polos } from '@polos/sdk';
161
187
  // Import agents and workflows for registration
162
188
  import './agents/coding-agent.js';
163
189
  import './agents/assistant-agent.js';
164
- import './agents/text-review/agents.js';
165
- import './agents/text-review/workflow.js';
190
+ import './workflows/text-review/agents.js';
191
+ import './workflows/text-review/workflow.js';
166
192
 
167
193
  const polos = new Polos();
194
+
195
+ console.log('');
196
+ console.log('\\x1b[1mPolos worker starting...\\x1b[0m');
197
+ console.log('');
198
+ console.log(\` UI: \${process.env.POLOS_UI_URL || 'http://localhost:5173'}\`);
199
+ console.log('');
200
+ console.log(' Run an agent:');
201
+ console.log(' polos run assistant_agent');
202
+ console.log(' polos run coding_agent --input "Write a hello world script"');
203
+ console.log('');
204
+ console.log(' Run a workflow:');
205
+ console.log(' polos invoke text_review --input "Your text here"');
206
+ console.log('');
207
+
168
208
  await polos.serve();
169
209
  `;
170
210
  }
@@ -173,24 +213,16 @@ await polos.serve();
173
213
  function codingAgentTemplate(provider) {
174
214
  return `${provider.import};
175
215
  import { defineAgent, maxSteps, sandboxTools } from '@polos/sdk';
176
- import path from 'node:path';
177
-
178
- const workspaceDir = path.resolve(process.cwd(), 'workspace');
179
216
 
180
217
  const tools = sandboxTools({
181
218
  env: 'local',
182
- local: {
183
- cwd: workspaceDir,
184
- pathRestriction: workspaceDir,
185
- },
219
+ scope: 'session',
186
220
  });
187
221
 
188
222
  export const codingAgent = defineAgent({
189
223
  id: 'coding_agent',
190
224
  model: ${provider.call},
191
- systemPrompt: \`You are a coding agent with access to sandbox tools.
192
- Your workspace is at \${workspaceDir}.
193
- Use your tools to read, write, and execute code.\`,
225
+ systemPrompt: 'You are a coding agent with access to sandbox tools. Use your tools to read, write, and execute code.',
194
226
  tools,
195
227
  stopConditions: [maxSteps({ count: 30 })],
196
228
  });
@@ -204,37 +236,18 @@ import {
204
236
  defineAgent,
205
237
  maxSteps,
206
238
  sandboxTools,
207
- createWebSearchTool,
208
- createAskUserTool,
209
239
  } from '@polos/sdk';
210
- import path from 'node:path';
211
-
212
- const workspaceDir = path.resolve(process.cwd(), 'workspace');
213
240
 
214
241
  const sandbox = sandboxTools({
215
242
  env: 'local',
216
- local: {
217
- cwd: workspaceDir,
218
- pathRestriction: workspaceDir,
219
- },
220
- });
221
-
222
- const webSearch = createWebSearchTool({
223
- maxResults: 5,
224
- searchDepth: 'basic',
225
- includeAnswer: true,
226
- approval: 'always',
243
+ scope: 'session',
227
244
  });
228
245
 
229
- const askUser = createAskUserTool();
230
-
231
246
  export const assistantAgent = defineAgent({
232
247
  id: 'assistant_agent',
233
248
  model: ${provider.call},
234
- systemPrompt: \`You are a helpful assistant with access to sandbox tools, web search, and the ability to ask the user for clarification.
235
- Your workspace is at \${workspaceDir}.
236
- Use your tools to help the user with their tasks.\`,
237
- tools: [...sandbox, webSearch, askUser],
249
+ systemPrompt: 'You are a helpful assistant with access to sandbox tools. Use your tools to help the user with their tasks.',
250
+ tools: [...sandbox],
238
251
  stopConditions: [maxSteps({ count: 30 })],
239
252
  });
240
253
  `;
@@ -367,8 +380,8 @@ function generateFiles(projectName, provider) {
367
380
  { path: "src/main.ts", content: mainTsTemplate() },
368
381
  { path: "src/agents/coding-agent.ts", content: codingAgentTemplate(provider) },
369
382
  { path: "src/agents/assistant-agent.ts", content: assistantAgentTemplate(provider) },
370
- { path: "src/agents/text-review/agents.ts", content: textReviewAgentsTemplate(provider) },
371
- { path: "src/agents/text-review/workflow.ts", content: textReviewWorkflowTemplate() }
383
+ { path: "src/workflows/text-review/agents.ts", content: textReviewAgentsTemplate(provider) },
384
+ { path: "src/workflows/text-review/workflow.ts", content: textReviewWorkflowTemplate() }
372
385
  ];
373
386
  }
374
387
  function scaffoldProject(projectDir, files) {
@@ -427,7 +440,7 @@ async function main() {
427
440
  s.start("Creating project files...");
428
441
  const files = generateFiles(projectName, provider);
429
442
  scaffoldProject(projectDir, files);
430
- s.stop("Project files created.");
443
+ s.stop("Installing project...");
431
444
  s.start("Installing dependencies...");
432
445
  const installed = installDependencies(projectDir);
433
446
  if (installed) {
@@ -440,6 +453,11 @@ async function main() {
440
453
  Next steps:
441
454
  cd ${projectName}
442
455
  cp .env.example .env # add your ${provider.envVar}
443
- npx polos dev`);
456
+ polos dev
457
+
458
+ Common commands:
459
+ polos agent list # list registered agents
460
+ polos run assistant_agent # chat with the assistant agent
461
+ polos run assistant_agent --input "hi" # one-shot mode`);
444
462
  }
445
463
  main().catch(console.error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-polos",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Scaffold a new Polos agent project",
5
5
  "type": "module",
6
6
  "bin": {
@@ -19,6 +19,11 @@
19
19
  "scaffolding",
20
20
  "cli"
21
21
  ],
22
+ "repository": {
23
+ "type": "git",
24
+ "url": "https://github.com/polos-dev/polos",
25
+ "directory": "create-polos-ts"
26
+ },
22
27
  "license": "Apache-2.0",
23
28
  "dependencies": {
24
29
  "@clack/prompts": "^0.9.1"