create-polos 0.1.0 → 0.1.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.
Files changed (2) hide show
  1. package/dist/index.js +62 -46
  2. package/package.json +1 -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,15 @@ 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
- },
186
219
  });
187
220
 
188
221
  export const codingAgent = defineAgent({
189
222
  id: 'coding_agent',
190
223
  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.\`,
224
+ systemPrompt: 'You are a coding agent with access to sandbox tools. Use your tools to read, write, and execute code.',
194
225
  tools,
195
226
  stopConditions: [maxSteps({ count: 30 })],
196
227
  });
@@ -204,37 +235,17 @@ import {
204
235
  defineAgent,
205
236
  maxSteps,
206
237
  sandboxTools,
207
- createWebSearchTool,
208
- createAskUserTool,
209
238
  } from '@polos/sdk';
210
- import path from 'node:path';
211
-
212
- const workspaceDir = path.resolve(process.cwd(), 'workspace');
213
239
 
214
240
  const sandbox = sandboxTools({
215
241
  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',
227
242
  });
228
243
 
229
- const askUser = createAskUserTool();
230
-
231
244
  export const assistantAgent = defineAgent({
232
245
  id: 'assistant_agent',
233
246
  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],
247
+ systemPrompt: 'You are a helpful assistant with access to sandbox tools. Use your tools to help the user with their tasks.',
248
+ tools: [...sandbox],
238
249
  stopConditions: [maxSteps({ count: 30 })],
239
250
  });
240
251
  `;
@@ -367,8 +378,8 @@ function generateFiles(projectName, provider) {
367
378
  { path: "src/main.ts", content: mainTsTemplate() },
368
379
  { path: "src/agents/coding-agent.ts", content: codingAgentTemplate(provider) },
369
380
  { 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() }
381
+ { path: "src/workflows/text-review/agents.ts", content: textReviewAgentsTemplate(provider) },
382
+ { path: "src/workflows/text-review/workflow.ts", content: textReviewWorkflowTemplate() }
372
383
  ];
373
384
  }
374
385
  function scaffoldProject(projectDir, files) {
@@ -427,7 +438,7 @@ async function main() {
427
438
  s.start("Creating project files...");
428
439
  const files = generateFiles(projectName, provider);
429
440
  scaffoldProject(projectDir, files);
430
- s.stop("Project files created.");
441
+ s.stop("Installing project...");
431
442
  s.start("Installing dependencies...");
432
443
  const installed = installDependencies(projectDir);
433
444
  if (installed) {
@@ -440,6 +451,11 @@ async function main() {
440
451
  Next steps:
441
452
  cd ${projectName}
442
453
  cp .env.example .env # add your ${provider.envVar}
443
- npx polos dev`);
454
+ polos dev
455
+
456
+ Common commands:
457
+ polos agent list # list registered agents
458
+ polos run assistant_agent # chat with the assistant agent
459
+ polos run assistant_agent --input "hi" # one-shot mode`);
444
460
  }
445
461
  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.1",
4
4
  "description": "Scaffold a new Polos agent project",
5
5
  "type": "module",
6
6
  "bin": {